{"id":1068,"date":"2026-07-07T08:35:26","date_gmt":"2026-07-07T08:35:26","guid":{"rendered":"https:\/\/opshub.com.cn\/?p=1068"},"modified":"2026-07-07T09:17:08","modified_gmt":"2026-07-07T09:17:08","slug":"rancher-ha-k8s%e9%ab%98%e5%8f%af%e7%94%a8%e9%9b%86%e7%be%a4%ef%bc%88helm-cli%e7%a6%bb%e7%ba%bf%e9%83%a8%e7%bd%b2%ef%bc%89","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=1068","title":{"rendered":"Rancher HA K8S\u9ad8\u53ef\u7528\u96c6\u7fa4\uff08Helm cli\u79bb\u7ebf\u90e8\u7f72\uff09"},"content":{"rendered":"\n<p>\u4e00\u3001\u914d\u7f6e\u57fa\u7840\u8bbe\u65bd\u548c\u79c1\u6709\u955c\u50cf\u4ed3\u5e93<\/p>\n\n\n\n<p>\u5728 RKE \u96c6\u7fa4\u4e2d\u5b89\u88c5 Rancher \u9ad8\u53ef\u7528\uff0c\u6211\u4eec\u5efa\u8bae\u4e3a\u9ad8\u53ef\u7528\u5b89\u88c5\u914d\u7f6e\u4ee5\u4e0b\u57fa\u7840\u8bbe\u65bd\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>3 \u4e2a Linux \u8282\u70b9<\/strong>\uff0c\u901a\u5e38\u662f\u865a\u62df\u673a\uff0c\u4f60\u53ef\u4ee5\u81ea\u884c\u9009\u62e9\u7684\u57fa\u7840\u8bbe\u65bd\u63d0\u4f9b\u5546\uff0c\u4f8b\u5982 Amazon EC2\u3001\u963f\u91cc\u4e91\u3001\u817e\u8baf\u4e91\u6216\u8005 vShpere\u3002<\/li>\n\n\n\n<li><strong>1 \u4e2a\u8d1f\u8f7d\u5747\u8861\u5668<\/strong>\uff0c\u7528\u4e8e\u5c06\u6d41\u91cf\u8f6c\u53d1\u5230\u8fd9\u4e09\u4e2a\u8282\u70b9\u3002<\/li>\n\n\n\n<li><strong>1 \u6761 DNS \u8bb0\u5f55<\/strong>\uff0c\u7528\u4e8e\u5c06 URL \u6307\u5411\u8d1f\u8f7d\u5747\u8861\u5668\u3002\u8fd9\u5c06\u6210\u4e3a Rancher Server \u7684 URL\uff0c\u4e0b\u6e38\u96c6\u7fa4\u9700\u8981\u53ef\u4ee5\u8bbf\u95ee\u5230\u8fd9\u4e2a\u5730\u5740\u3002<\/li>\n\n\n\n<li><strong>\u79c1\u6709 Docker \u955c\u50cf\u4ed3\u5e93<\/strong>\uff0c\u7528\u4e8e\u4e3a\u4f60\u7684\u8282\u70b9\u5206\u53d1 Docker \u955c\u50cf\u3002<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\u89d2\u8272<\/td><td>ip\u5730\u5740<\/td><td>\u64cd\u4f5c\u7cfb\u7edf<\/td><\/tr><tr><td>controlplane\/worker\/etcd<\/td><td>192.168.1.170<\/td><td>CentOS Linux release 8.4.2105<\/td><\/tr><tr><td>controlplane\/worker\/etcd<\/td><td>192.168.1.171<\/td><td>CentOS Linux release 8.4.2105<\/td><\/tr><tr><td>controlplane\/worker\/etcd<\/td><td>192.168.1.172<\/td><td>CentOS Linux release 8.4.2105<\/td><\/tr><tr><td>Harbor\uff08\u79c1\u6709docker\u955c\u50cf\u4ed3\u5e93\uff09<\/td><td>192.168.1.178<\/td><td>CentOS Linux release 8.4.2105<\/td><\/tr><tr><td>Nginx\uff08\u8d1f\u8f7d\u5747\u8861\u5668\uff09<\/td><td>192.168.1.179<\/td><td>CentOS Linux release 8.4.2105<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>3\u4e2aLinux\u8282\u70b9\uff1a4\u6838\/8G\/100G<\/li>\n\n\n\n<li>Harbor\uff1a4\u6838\u5fc3\/8G\/100G<\/li>\n\n\n\n<li>Nginx\uff1a1\u6838\/1G\/50G<\/li>\n<\/ul>\n\n\n\n<p>\u6bcf\u4e2a\u670d\u52a1\u5668\u6267\u884c\u6807\u51c6\u521d\u59cb\u5316\uff1a<\/p>\n\n\n\n<p>init_centos8.sh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\/bin\/rm -f \/etc\/yum.repos.d\/*.repo\ncat &gt; \/etc\/yum.repos.d\/CentOS-Media.repo &lt;&lt;EOF\n&#91;BaseOS]\nname=CentOS-8.4.2105 - BaseOS\nbaseurl=https:\/\/mirror.nju.edu.cn\/centos-vault\/8.4.2105\/BaseOS\/\\$basearch\/os\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/mirror.nju.edu.cn\/centos\/RPM-GPG-KEY-CentOS-Official\n\n&#91;AppStream]\nname=CentOS-8.4.2105 - AppStream\nbaseurl=https:\/\/mirror.nju.edu.cn\/centos-vault\/8.4.2105\/AppStream\/\\$basearch\/os\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/mirror.nju.edu.cn\/centos\/RPM-GPG-KEY-CentOS-Official\n\n&#91;PowerTools]\nname=CentOS-8.4.2105 - PowerTools\nbaseurl=https:\/\/mirror.nju.edu.cn\/centos-vault\/8.4.2105\/PowerTools\/\\$basearch\/os\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/mirror.nju.edu.cn\/centos\/RPM-GPG-KEY-CentOS-Official\n\n&#91;Extras]\nname=CentOS-8.4.2105 - Extras\nbaseurl=https:\/\/mirror.nju.edu.cn\/centos-vault\/8.4.2105\/extras\/\\$basearch\/os\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/mirror.nju.edu.cn\/centos\/RPM-GPG-KEY-CentOS-Official\nEOF\nyum clean all\nyum makecache\nyum -y install chrony curl gzip unzip net-tools tar socat conntrack ebtables ipset\ncat &gt; \/etc\/chrony.conf &lt;&lt;EOF\npool time.gpst.net.cn iburst minpoll 3 maxpoll 3 maxsources 1 prefer\npool ntp.ubuntu.com        iburst maxsources 4\npool 0.ubuntu.pool.ntp.org iburst maxsources 1\npool 1.ubuntu.pool.ntp.org iburst maxsources 1\npool 2.ubuntu.pool.ntp.org iburst maxsources 2\nstratumweight 0.05\ndriftfile \/var\/lib\/chrony\/drift\nrtcsync\nmakestep 0.5 3\nbindcmdaddress 127.0.0.1\nbindcmdaddress ::1\nnoclientlog\nlogchange 0.5\nlogdir \/var\/log\/chrony\nEOF\nsystemctl enable --now chronyd\nchronyc makestep\n\/bin\/cp -f \/usr\/share\/zoneinfo\/Asia\/Shanghai \/etc\/localtime\ncat &gt;&gt; \/etc\/security\/limits.conf &lt;&lt;EOF\n* soft nofile 65535\n* hard nofile 65535\nroot soft nofile 65535\nroot hard nofile 65535\nEOF\nsystemctl disable --now firewalld\nsystemctl stop firewalld\nmodprobe br_netfilter\necho \"br_netfilter\" &gt;\/etc\/modules-load.d\/net.conf\nsed -i '\/net.ipv4.ip_forward\\|net.bridge.bridge\\-nf\\-call\\-iptables\/d' \/etc\/sysctl.conf \necho \"net.ipv4.ip_forward = 1\" &gt;&gt; \/etc\/sysctl.conf\necho \"net.bridge.bridge-nf-call-iptables=1\" &gt;&gt;\/etc\/sysctl.conf\nsysctl -p\nsed -i '\/^SELINUX=\/s\/\\(.*\\)=\\(.*\\)\/\\1=disabled\/g' \/etc\/selinux\/config\nsetenforce 0\n\ncat &gt;&gt; \/etc\/profile &lt;&lt;EOF\nexport HTTP_PROXY=http:\/\/192.168.1.77:5704\/\nexport HTTPS_PROXY=http:\/\/192.168.1.77:5704\/\n# \u5185\u7f51\/\u96c6\u7fa4\u7f51\u6bb5\u4e0d\u8d70\u4ee3\u7406\uff08\u5173\u952e\uff0c\u5426\u5219\u96c6\u7fa4\u901a\u4fe1\u5f02\u5e38\uff09\nexport NO_PROXY=127.0.0.1,localhost,lb.kubesphere.local,10.0.0.0\/8,192.168.0.0\/16,172.16.0.0\/12,.local\n# \u5c0f\u5199\u517c\u5bb9\nexport http_proxy=\\$HTTP_PROXY\nexport https_proxy=\\$HTTPS_PROXY\nexport no_proxy=\\$NO_PROXY\n\n# \u56fd\u5185\u52a0\u901f\uff0c\u5fc5\u987b\u52a0\nexport KKZONE=cn\nEOF\nsource \/etc\/profile\n<\/code><\/pre>\n\n\n\n<p>1\u3001\u5b89\u88c5Harbor\uff08\u79c1\u7f51docker\u955c\u50cf\u4ed3\u5e93\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/opshub.com.cn\/?p=392\" data-type=\"link\" data-id=\"https:\/\/opshub.com.cn\/?p=392\">\u5b89\u88c5\u597ddocker\u73af\u5883\u548cdockers-compose\u5de5\u5177<\/a><\/li>\n\n\n\n<li>\u51c6\u5907\u597dharbor\u7684\u81ea\u7b7e\u540d\u8bc1\u4e66\u548c\u5bc6\u94a5\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/opshub.com.cn\/?p=1128\">\u4f7f\u7528easyrsa\u5236\u4f5c\u81ea\u7b7e\u540d\u8bc1\u4e66\u548c\u5bc6\u94a5<\/a><\/li>\n\n\n\n<li>\u5c06harbor.crt\u548charbor.key\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u7684\/data\/ssl\/\u8def\u5f84\u4e0b\u5b58\u653e<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u4e0b\u8f7dharbor\u7684\u79bb\u7ebf\u5b89\u88c5\u5305\uff1a<a href=\"https:\/\/github.com\/goharbor\/harbor\/releases\/download\/v2.15.2\/harbor-offline-installer-v2.15.2.tgz\">https:\/\/github.com\/goharbor\/harbor\/releases\/download\/v2.15.2\/harbor-offline-installer-v2.15.2.tgz<\/a>\n<ul class=\"wp-block-list\">\n<li>\u5c06\u79bb\u7ebf\u5b89\u88c5\u5305\u5b58\u653e\u5230\u670d\u52a1\u5668\u7684\/data\/install\u8def\u5f84\u4e0b\u5b58\u653e<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5b89\u88c5harbor<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tar zxf <a href=\"https:\/\/github.com\/goharbor\/harbor\/releases\/download\/v2.15.2\/harbor-offline-installer-v2.15.2.tgz\">harbor-offline-installer-v2.15.2.tgz<\/a>\ncd harbor\ncp harbor.yml.tmpl harbor.yml<\/code><\/pre>\n\n\n\n<p>harbor.yml\u4fee\u6539\u4e09\u5904\u4e3a\u5b9e\u9645\u8bbe\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostname: dockerhub.gpst.net.cn\ncertificate: \/data\/ssl\/harbor.crt\nprivate_key: \/data\/ssl\/harbor.key<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>bash .\/install.sh<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5373\u53ef\u901a\u8fc7dockerhub.gpst.net.cn\u8bbf\u95ee\u79c1\u7f51docker\u955c\u50cf\u4ed3\u5e93\uff0c\u9ed8\u8ba4\u7684\u7528\u6237\u540d\/\u5bc6\u7801: admin\/Harbor12345<\/p>\n\n\n\n<p>2\u3001\u5b89\u88c5Nginx\uff08\u8d1f\u8f7d\u5747\u8861\u5668\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/opshub.com.cn\/?p=1136\" data-type=\"link\" data-id=\"https:\/\/opshub.com.cn\/?p=392\">\u5b89\u88c5\u597ddocker 20.10.24\u73af\u5883<\/a> \uff08rke v1.2.23\u517c\u5bb9docker 20.10.24\uff09<\/li>\n\n\n\n<li>\u5199\u597dnginx.conf\u914d\u7f6e\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>worker_processes 4;\nworker_rlimit_nofile 40000;\n\nevents {\n    worker_connections 8192;\n}\n\nstream {\n    upstream rancher_servers_http {\n        least_conn;\n        server 192.168.1.170:80 max_fails=3 fail_timeout=5s;\n        server 192.168.1.171:80 max_fails=3 fail_timeout=5s;\n        server 192.168.1.172:80 max_fails=3 fail_timeout=5s;\n    }\n    server {\n        listen 80;\n        proxy_pass rancher_servers_http;\n    }\n\n    upstream rancher_servers_https {\n        least_conn;\n        server 192.168.1.170:443 max_fails=3 fail_timeout=5s;\n        server 192.168.1.171:443 max_fails=3 fail_timeout=5s;\n        server 192.168.1.172:443 max_fails=3 fail_timeout=5s;\n    }\n    server {\n        listen     443;\n        proxy_pass rancher_servers_https;\n    }\n\n}\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5c06nginx.conf\u5b58\u653e\u5230\/data\/nginx\/etc\/\u6587\u4ef6\u5939\u4e0b<\/li>\n\n\n\n<li>\u8fd0\u884cdocker\u5bb9\u5668\u542f\u52a8\u547d\u4ee4\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -itd --name nginx --restart=always -p 80:80 -p 443:443 -v \/data\/nginx\/etc\/nginx.conf:\/etc\/nginx\/nginx.conf:rw dockerhub.gpst.net.cn\/library\/nginx:latest<\/code><\/pre>\n\n\n\n<p>\u4e8c\u3001\u540c\u6b65\u955c\u50cf\u5230\u79c1\u6709\u4ed3\u5e93<\/p>\n\n\n\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cRancher \u4e2d\u6240\u6709\u7528\u4e8e\u521b\u5efa Kubernetes \u96c6\u7fa4\u6216\u542f\u52a8 Rancher \u4e2d\u4efb\u4f55\u5de5\u5177\uff08\u5982\u76d1\u63a7\u548c\u65e5\u5fd7\uff09\u7684\u955c\u50cf\u90fd\u6765\u81ea Docker Hub\u3002\u5728 Rancher \u7684\u79bb\u7ebf\u5b89\u88c5\u4e2d\uff0c\u4f60\u5c06\u9700\u8981\u4e00\u4e2a\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\uff0c\u8be5\u955c\u50cf\u4ed3\u5e93\u4f4d\u4e8e\u4f60\u7684 Rancher Server \u53ef\u8bbf\u95ee\u7684\u67d0\u4e2a\u4f4d\u7f6e\u3002\u7136\u540e\uff0c\u4f60\u5c06\u5728\u955c\u50cf\u4ed3\u5e93\u4e2d\u52a0\u8f7d\u6240\u6709\u7684\u955c\u50cf\u3002<\/p>\n\n\n\n<p>rancher-save-images.sh\uff0c\u8fd9\u4e2a\u811a\u672c\u4f1a\u4ece DockerHub \u4e2d\u62c9\u53d6\u5728\u6587\u4ef6<code>rancher-images.txt<\/code>\u4e2d\u63cf\u8ff0\u7684\u6240\u6709\u955c\u50cf\uff0c\u5e76\u5c06\u5b83\u4eec\u4fdd\u5b58\u4e3a\u6587\u4ef6<code>rancher-images.tar.gz<\/code>\u3002\u6539\u5199\u5b98\u65b9\u811a\u672c\u4e3a\u591a\u7ebf\u7a0b\u62c9\u53d6\u955c\u50cf\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nlist=\"rancher-images.txt\"\nimages=\"rancher-images.tar.gz\"\nsource_registry=\"\"\n\nusage() {\n\techo \"USAGE: $0 &#91;--image-list rancher-images.txt] &#91;--images rancher-images.tar.gz]\"\n\techo \"  &#91;-s|--source-registry] source registry to pull images from in registry:port format.\"\n\techo \"  &#91;-l|--image-list path] text file with list of images; one image per line.\"\n\techo \"  &#91;-i|--images path] tar.gz generated by docker save.\"\n\techo \"  &#91;-h|--help] Usage message\"\n}\n\nPOSITIONAL=()\nwhile &#91;&#91; $# -gt 0 ]]; do\n\tkey=\"$1\"\n\tcase $key in\n\t-i | --images)\n\t\timages=\"$2\"\n\t\tshift # past argument\n\t\tshift # past value\n\t\t;;\n\t-l | --image-list)\n\t\tlist=\"$2\"\n\t\tshift # past argument\n\t\tshift # past value\n\t\t;;\n\t-s | --source-registry)\n\t\tsource_registry=\"$2\"\n\t\tshift # past argument\n\t\tshift # past value\n\t\t;;\n\t-h | --help)\n\t\thelp=\"true\"\n\t\tshift\n\t\t;;\n\t*)\n\t\tusage\n\t\texit 1\n\t\t;;\n\tesac\ndone\n\nif &#91;&#91; $help ]]; then\n\tusage\n\texit 0\nfi\n\nsource_registry=\"${source_registry%\/}\"\nif &#91; ! -z \"${source_registry}\" ]; then\n\tsource_registry=\"${source_registry}\/\"\nfi\nthreads=20\nfifofile=\/tmp\/$$.fifo\nmkfifo $fifofile\nexec 6&lt;&gt;$fifofile\n\/bin\/rm $fifofile\nfor ((i = 0; i &lt; $threads; i++)); do\n\techo &gt;&amp;6\ndone\npulled=\"\"\nTmpList=\/tmp\/rancher_$$.txt\ncat \/dev\/null &gt;$TmpList\nwhile IFS= read -r i; do\n\t&#91; -z \"${i}\" ] &amp;&amp; continue\n\tread -u6\n\t{\n\t\ti=\"${source_registry}${i}\"\n\t\tif docker pull \"${i}\" &gt;\/dev\/null 2&gt;&amp;1; then\n\t\t\techo \"Image pull success: ${i}\"\n\t\t\techo \"${i}\" &gt;&gt;$TmpList\n\t\telse\n\t\t\tif docker inspect \"${i}\" &gt;\/dev\/null 2&gt;&amp;1; then\n\t\t\t\techo \"${i}\" &gt;&gt;$TmpList\n\t\t\telse\n\t\t\t\techo \"Image pull failed: ${i}\"\n\t\t\tfi\n\t\tfi\n\t\techo &gt;&amp;6\n\t} &amp;\ndone &lt;\"${list}\"\nwait\nexec 6&gt;&amp;- 6&lt;&amp;-\npulled=\"$(cat $TmpList | awk '{printf\"%s \",$0}')\"\necho \"Creating ${images} with $(echo ${pulled} | wc -w | tr -d '&#91;:space:]') images\"\ndocker save $(echo ${pulled}) | gzip --stdout &gt;${images}\nif &#91;&#91; -f \"$images\" ]]; then\n\t\/bin\/rm -f $TmpList\nfi\n<\/code><\/pre>\n\n\n\n<p>rancher-load-images.sh\uff0c\u8fd9\u4e2a\u811a\u672c\u4f1a\u8f7d\u5165\u6587\u4ef6<code>rancher-images.tar.gz<\/code>\u4e2d\u7684\u955c\u50cf\uff0c\u5e76\u5c06\u5b83\u4eec\u63a8\u9001\u5230\u4f60\u81ea\u5df1\u7684\u79c1\u6709\u955c\u50cf\u5e93\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nimages=\"rancher-images.tar.gz\"\nlist=\"rancher-images.txt\"\nwindows_image_list=\"\"\nwindows_versions=\"1809\"\nsource_registry=\"\"\nusage () {\n    echo \"USAGE: $0 &#91;--images rancher-images.tar.gz] &#91;--source-registry index.docker.io] --registry my.registry.com:5000\"\n    echo \"  &#91;-l|--image-list path] text file with list of images; one image per line.\"\n    echo \"  &#91;-i|--images path] tar.gz generated by docker save.\"\n    echo \"  &#91;-r|--registry registry:port] target private registry in the registry:port format.\"\n    echo \"  &#91;-s|--source-registry registry:port] source registry in the registry:port format.\"\n    echo \"  &#91;--windows-image-list path] text file with list of images used in Windows. Windows image mirroring is skipped when this is empty.\"\n    echo \"  &#91;--windows-versions version] Comma separated Windows versions. e.g., \\\"1809,ltsc2022\\\". (Default \\\"1809\\\")\"\n    echo \"  &#91;-h|--help] Usage message\"\n}\n\npush_manifest () {\n    export DOCKER_CLI_EXPERIMENTAL=enabled\n    manifest_list=()\n    for i in \"${arch_list&#91;@]}\"\n    do\n        manifest_list+=(\"$1-${i}\")\n    done\n\n    echo \"Preparing manifest $1, list&#91;${arch_list&#91;@]}]\"\n    docker manifest create \"$1\" \"${manifest_list&#91;@]}\" --amend\n    docker manifest push \"$1\" --purge\n}\n\nwhile &#91;&#91; $# -gt 0 ]]; do\n    key=\"$1\"\n    case $key in\n        -r|--registry)\n        target_registry=\"$2\"\n        shift # past argument\n        shift # past value\n        ;;\n        -s|--source-registry)\n        source_registry=\"$2\"\n        shift # past argument\n        shift # past value\n        ;;\n        -l|--image-list)\n        list=\"$2\"\n        shift # past argument\n        shift # past value\n        ;;\n        -i|--images)\n        images=\"$2\"\n        shift # past argument\n        shift # past value\n        ;;\n        --windows-image-list)\n        windows_image_list=\"$2\"\n        shift # past argument\n        shift # past value\n        ;;\n        --windows-versions)\n        windows_versions=\"$2\"\n        shift # past argument\n        shift # past value\n        ;;\n        -h|--help)\n        help=\"true\"\n        shift\n        ;;\n        *)\n        usage\n        exit 1\n        ;;\n    esac\ndone\nif &#91;&#91; -z \"${target_registry}\" ]]; then\n    usage\n    exit 1\nfi\nif &#91;&#91; $help ]]; then\n    usage\n    exit 0\nfi\n\ntarget_registry=\"${target_registry%\/}\/\"\nsource_registry=\"${source_registry%\/}\"\nif &#91; ! -z \"${source_registry}\" ]; then\n    source_registry=\"${source_registry}\/\"\nfi\n\ndocker load --input ${images}\n\nlinux_images=()\nwhile IFS= read -r i; do\n    &#91; -z \"${i}\" ] &amp;&amp; continue\n    linux_images+=(\"${i}\");\ndone &lt; \"${list}\"\n\narch_list=()\nif &#91;&#91; -n \"${windows_image_list}\" ]]; then\n    IFS=',' read -r -a versions &lt;&lt;&lt; \"$windows_versions\"\n    for version in \"${versions&#91;@]}\"\n    do\n        arch_list+=(\"windows-${version}\")\n    done\n\n    windows_images=()\n    while IFS= read -r i; do\n        &#91; -z \"${i}\" ] &amp;&amp; continue\n        windows_images+=(\"${i}\")\n    done &lt; \"${windows_image_list}\"\n\n    # use manifest to publish images only used in Windows\n    for i in \"${windows_images&#91;@]}\"; do\n        if &#91;&#91; ! \" ${linux_images&#91;@]}\" =~ \" ${i}\" ]]; then\n            case $i in\n            *\/*)\n                image_name=\"${target_registry}${i}\"\n                ;;\n            *)\n                image_name=\"${target_registry}rancher\/${i}\"\n                ;;\n            esac\n            push_manifest \"${image_name}\"\n        fi\n    done\nfi\n\narch_list+=(\"linux-amd64\")\nfor i in \"${linux_images&#91;@]}\"; do\n    &#91; -z \"${i}\" ] &amp;&amp; continue\n    arch_suffix=\"\"\n    use_manifest=false\n    if &#91;&#91; (-n \"${windows_image_list}\") &amp;&amp; \" ${windows_images&#91;@]}\" =~ \" ${i}\" ]]; then\n        # use manifest to publish images when it is used both in Linux and Windows\n        use_manifest=true\n        arch_suffix=\"-linux-amd64\"\n    fi\n    case $i in\n    *\/*)\n        image_name=\"${target_registry}${i}\"\n        ;;\n    *)\n        image_name=\"${target_registry}rancher\/${i}\"\n        ;;\n    esac\n\n    docker tag \"${source_registry}${i}\" \"${image_name}${arch_suffix}\"\n    docker push \"${image_name}${arch_suffix}\"\n\n    if $use_manifest; then\n        push_manifest \"${image_name}\"\n    fi\ndone\n<\/code><\/pre>\n\n\n\n<p>rancher-images.txt\uff0c\u6b64\u6587\u4ef6\u5305\u542b\u5b89\u88c5 Rancher\u3001\u521b\u5efa\u96c6\u7fa4\u548c\u8fd0\u884c Rancher \u5de5\u5177\u6240\u9700\u7684\u955c\u50cf\u5217\u8868\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>rancher\u7248\u672c\uff1av2.5.17<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>busybox\nrancher\/backup-restore-operator:v1.2.1\nrancher\/cis-operator:v1.0.7\nrancher\/configmap-reload:v0.3.0-rancher4\nrancher\/coredns-coredns:1.6.2\nrancher\/coredns-coredns:1.6.9\nrancher\/coredns-coredns:1.8.3\nrancher\/coreos-kube-state-metrics:v1.9.7\nrancher\/coreos-prometheus-config-reloader:v0.39.0\nrancher\/coreos-prometheus-operator:v0.39.0\nrancher\/eks-operator:v1.0.10\nrancher\/externalip-webhook:v0.1.6\nrancher\/flannel-cni:v0.3.0-rancher6\nrancher\/fleet-agent:v0.3.10-security1\nrancher\/fleet:v0.3.10-security1\nrancher\/fluentd:v0.1.30\nrancher\/gitjob:v0.1.26-security1\nrancher\/gke-operator:v1.1.1\nrancher\/grafana-grafana:6.7.4\nrancher\/grafana-grafana:7.1.5\nrancher\/hyperkube:v1.17.17-rancher2\nrancher\/hyperkube:v1.18.20-rancher1\nrancher\/hyperkube:v1.19.16-rancher2\nrancher\/hyperkube:v1.20.15-rancher2\nrancher\/istio-1.5-migration:0.1.1\nrancher\/istio-citadel:1.5.9\nrancher\/istio-coredns-plugin:0.2-istio-1.1\nrancher\/istio-galley:1.5.9\nrancher\/istio-installer:1.11.7-rancher1\nrancher\/istio-kubectl:1.4.6\nrancher\/istio-kubectl:1.5.10\nrancher\/istio-kubectl:1.5.9\nrancher\/istio-mixer:1.5.9\nrancher\/istio-node-agent-k8s:1.5.9\nrancher\/istio-pilot:1.5.9\nrancher\/istio-proxyv2:1.5.9\nrancher\/istio-sidecar_injector:1.5.9\nrancher\/jaegertracing-all-in-one:1.14\nrancher\/jetstack-cert-manager-controller:v0.8.1\nrancher\/jimmidyson-configmap-reload:v0.3.0\nrancher\/k3s-upgrade:v1.17.17-k3s1\nrancher\/k3s-upgrade:v1.18.20-k3s1\nrancher\/k3s-upgrade:v1.19.16-k3s1\nrancher\/k3s-upgrade:v1.20.15-k3s1\nrancher\/kiali-kiali:v1.17\nrancher\/klipper-helm:v0.2.3\nrancher\/klipper-helm:v0.4.3\nrancher\/klipper-helm:v0.6.6-build20211022\nrancher\/klipper-lb:v0.1.2\nrancher\/klipper-lb:v0.2.0\nrancher\/kube-api-auth:v0.1.4\nrancher\/kubectl:v1.18.0\nrancher\/kubectl:v1.20.2\nrancher\/kubectl:v1.21.5\nrancher\/kubernetes-external-dns:v0.7.3\nrancher\/library-busybox:1.32.1\nrancher\/library-traefik:1.7.19\nrancher\/local-path-provisioner:v0.0.11\nrancher\/local-path-provisioner:v0.0.14\nrancher\/local-path-provisioner:v0.0.19\nrancher\/log-aggregator:v0.1.8\nrancher\/metrics-server:v0.3.6\nrancher\/mirrored-banzaicloud-fluentd:v1.14.6-alpine-5\nrancher\/mirrored-banzaicloud-logging-operator:3.17.7\nrancher\/mirrored-calico-cni:v3.13.4\nrancher\/mirrored-calico-cni:v3.16.5\nrancher\/mirrored-calico-cni:v3.17.2\nrancher\/mirrored-calico-ctl:v3.13.4\nrancher\/mirrored-calico-ctl:v3.16.5\nrancher\/mirrored-calico-ctl:v3.17.2\nrancher\/mirrored-calico-kube-controllers:v3.13.4\nrancher\/mirrored-calico-kube-controllers:v3.16.5\nrancher\/mirrored-calico-kube-controllers:v3.17.2\nrancher\/mirrored-calico-node:v3.13.4\nrancher\/mirrored-calico-node:v3.16.5\nrancher\/mirrored-calico-node:v3.17.2\nrancher\/mirrored-calico-pod2daemon-flexvol:v3.13.4\nrancher\/mirrored-calico-pod2daemon-flexvol:v3.16.5\nrancher\/mirrored-calico-pod2daemon-flexvol:v3.17.2\nrancher\/mirrored-cloud-provider-vsphere-cpi-release-manager:v1.18.0\nrancher\/mirrored-cloud-provider-vsphere-cpi-release-manager:v1.19.0\nrancher\/mirrored-cloud-provider-vsphere-cpi-release-manager:v1.20.0\nrancher\/mirrored-cloud-provider-vsphere-cpi-release-manager:v1.21.0\nrancher\/mirrored-cloud-provider-vsphere-csi-release-driver:v2.3.0\nrancher\/mirrored-cloud-provider-vsphere-csi-release-syncer:v2.3.0\nrancher\/mirrored-cluster-proportional-autoscaler:1.7.1\nrancher\/mirrored-cluster-proportional-autoscaler:1.8.1\nrancher\/mirrored-coredns-coredns:1.6.5\nrancher\/mirrored-coredns-coredns:1.6.9\nrancher\/mirrored-coredns-coredns:1.7.0\nrancher\/mirrored-coredns-coredns:1.8.0\nrancher\/mirrored-coreos-etcd:v3.4.15-rancher1\nrancher\/mirrored-coreos-etcd:v3.4.3-rancher1\nrancher\/mirrored-coreos-flannel:v0.15.1\nrancher\/mirrored-curlimages-curl:7.77.0\nrancher\/mirrored-directxman12-k8s-prometheus-adapter:v0.8.4\nrancher\/mirrored-fluent-fluent-bit:1.9.3\nrancher\/mirrored-fluent-fluent-bit:1.9.3-debug\nrancher\/mirrored-grafana-grafana-image-renderer:3.0.1\nrancher\/mirrored-grafana-grafana:7.5.8\nrancher\/mirrored-idealista-prom2teams:3.2.1\nrancher\/mirrored-idealista-prom2teams:3.2.3\nrancher\/mirrored-ingress-nginx-kube-webhook-certgen:v1.1.1\nrancher\/mirrored-istio-install-cni:1.11.7\nrancher\/mirrored-istio-pilot:1.11.7\nrancher\/mirrored-istio-proxyv2:1.11.7\nrancher\/mirrored-jaegertracing-all-in-one:1.31.0\nrancher\/mirrored-jenkins-jnlp-slave:3.35-4\nrancher\/mirrored-jettech-kube-webhook-certgen:v1.5.2\nrancher\/mirrored-jimmidyson-configmap-reload:v0.4.0\nrancher\/mirrored-k8s-dns-dnsmasq-nanny:1.15.0\nrancher\/mirrored-k8s-dns-dnsmasq-nanny:1.15.10\nrancher\/mirrored-k8s-dns-dnsmasq-nanny:1.15.2\nrancher\/mirrored-k8s-dns-kube-dns:1.15.0\nrancher\/mirrored-k8s-dns-kube-dns:1.15.10\nrancher\/mirrored-k8s-dns-kube-dns:1.15.2\nrancher\/mirrored-k8s-dns-node-cache:1.15.13\nrancher\/mirrored-k8s-dns-node-cache:1.15.7\nrancher\/mirrored-k8s-dns-sidecar:1.15.0\nrancher\/mirrored-k8s-dns-sidecar:1.15.10\nrancher\/mirrored-k8s-dns-sidecar:1.15.2\nrancher\/mirrored-k8scsi-csi-node-driver-registrar:v2.1.0\nrancher\/mirrored-k8scsi-csi-resizer:v1.1.0\nrancher\/mirrored-k8scsi-livenessprobe:v2.2.0\nrancher\/mirrored-kiali-kiali:v1.41.0\nrancher\/mirrored-kiwigrid-k8s-sidecar:1.12.2\nrancher\/mirrored-kube-rbac-proxy:v0.5.0\nrancher\/mirrored-kube-state-metrics-kube-state-metrics:v2.0.0\nrancher\/mirrored-library-busybox:1.31.1\nrancher\/mirrored-library-nginx:1.19.9-alpine\nrancher\/mirrored-library-nginx:1.21.1-alpine\nrancher\/mirrored-longhornio-backing-image-manager:v2_20210820\nrancher\/mirrored-longhornio-csi-attacher:v3.2.1\nrancher\/mirrored-longhornio-csi-node-driver-registrar:v2.3.0\nrancher\/mirrored-longhornio-csi-provisioner:v2.1.2\nrancher\/mirrored-longhornio-csi-resizer:v1.2.0\nrancher\/mirrored-longhornio-csi-snapshotter:v3.0.3\nrancher\/mirrored-longhornio-longhorn-engine:v1.2.3\nrancher\/mirrored-longhornio-longhorn-instance-manager:v1_20211210\nrancher\/mirrored-longhornio-longhorn-manager:v1.2.3\nrancher\/mirrored-longhornio-longhorn-share-manager:v1_20211020\nrancher\/mirrored-longhornio-longhorn-ui:v1.2.3\nrancher\/mirrored-messagebird-sachet:0.2.3\nrancher\/mirrored-messagebird-sachet:0.2.6\nrancher\/mirrored-metrics-server:v0.3.6\nrancher\/mirrored-metrics-server:v0.5.0\nrancher\/mirrored-minio-minio:RELEASE.2020-07-13T18-09-56Z\nrancher\/mirrored-nginx-ingress-controller-defaultbackend:1.5-rancher1\nrancher\/mirrored-openpolicyagent-gatekeeper:v3.3.0\nrancher\/mirrored-pause:3.1\nrancher\/mirrored-pause:3.2\nrancher\/mirrored-pause:3.6\nrancher\/mirrored-plugins-docker:18.09\nrancher\/mirrored-prometheus-alertmanager:v0.22.2\nrancher\/mirrored-prometheus-node-exporter:v1.1.2\nrancher\/mirrored-prometheus-operator-prometheus-config-reloader:v0.48.0\nrancher\/mirrored-prometheus-operator-prometheus-operator:v0.48.0\nrancher\/mirrored-prometheus-prometheus:v2.27.1\nrancher\/mirrored-sig-storage-csi-attacher:v3.2.0\nrancher\/mirrored-sig-storage-csi-provisioner:v2.2.0\nrancher\/mirrored-sonobuoy-sonobuoy:v0.53.2\nrancher\/nginx-ingress-controller:nginx-0.35.0-rancher2\nrancher\/nginx-ingress-controller:nginx-1.2.1-rancher1\nrancher\/opa-gatekeeper:v3.1.0-beta.7\nrancher\/openzipkin-zipkin:2.14.2\nrancher\/pause:3.1\nrancher\/pipeline-jenkins-server:v0.1.4\nrancher\/pipeline-tools:v0.1.15\nrancher\/prom-alertmanager:v0.21.0\nrancher\/prom-node-exporter:v1.0.1\nrancher\/prom-prometheus:v2.12.0\nrancher\/prom-prometheus:v2.18.2\nrancher\/prometheus-auth:v0.2.1\nrancher\/pstauffer-curl:v1.0.3\nrancher\/pushprox-client:v0.1.0-rancher2-client\nrancher\/pushprox-proxy:v0.1.0-rancher2-proxy\nrancher\/rancher-agent:v2.5.17\nrancher\/rancher-operator:v0.1.5\nrancher\/rancher-runtime:v2.5.17\nrancher\/rancher-webhook:v0.1.6\nrancher\/rancher:v2.5.17\nrancher\/rke-tools:v0.1.74\nrancher\/rke-tools:v0.1.75\nrancher\/rke-tools:v0.1.78\nrancher\/rke-tools:v0.1.80\nrancher\/security-scan:v0.1.14\nrancher\/security-scan:v0.2.6\nrancher\/shell:v0.1.13\nrancher\/shell:v0.1.8\nrancher\/sonobuoy-sonobuoy:v0.16.3\nrancher\/system-upgrade-controller:v0.6.2\nrancher\/tekton-utils:v0.1.5\nrancher\/thanosio-thanos:v0.15.0\nrancher\/webhook-receiver:v0.2.4\nregistry:2\n<\/code><\/pre>\n\n\n\n<p>\u641c\u96c6cert-manager\u955c\u50cf\uff0c\u83b7\u53d6\u6700\u65b0\u7684<code>cert-manager<\/code>&nbsp;Helm chart\uff0c\u89e3\u6790\u6a21\u677f\u5e76\u83b7\u53d6\u955c\u50cf\u8be6\u7ec6\u4fe1\u606f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>cert-manager\u7248\u672c\uff1av1.5.1 \uff08\u517c\u5bb9\u9002\u914d\uff09<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>helm repo add jetstack https:\/\/charts.jetstack.io\nhelm repo update\nhelm fetch jetstack\/cert-manager --version v1.5.1\nhelm template .\/cert-manager-&lt;version&gt;.tgz | awk '$1 ~ \/image:\/ {print $2}' | sed s\/\\\"\/\/g &gt;&gt; .\/rancher-images.txt<\/code><\/pre>\n\n\n\n<p>\u6216\u8005\u76f4\u63a5\u8865\u5145rancher-images.txt\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>quay.io\/jetstack\/cert-manager-cainjector:v1.5.1\nquay.io\/jetstack\/cert-manager-controller:v1.5.1\nquay.io\/jetstack\/cert-manager-webhook:v1.5.1\nquay.io\/jetstack\/cert-manager-ctl:v1.5.1<\/code><\/pre>\n\n\n\n<p>\u5bf9\u955c\u50cf\u5217\u8868\u8fdb\u884c\u6392\u5e8f\u548c\u552f\u4e00\u5316\uff0c\u53bb\u9664\u91cd\u590d\u7684\u955c\u50cf\u6e90\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sort -u rancher-images.txt -o rancher-images.txt<\/code><\/pre>\n\n\n\n<p>\u5c06\u955c\u50cf\u4fdd\u5b58\u5230\u4f60\u7684\u5de5\u4f5c\u7ad9\u4e2d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x rancher-save-images.sh\n.\/rancher-save-images.sh --image-list .\/rancher-images.txt<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"1029\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/ScreenShot_2026-07-07_144920_250.png\" alt=\"\" class=\"wp-image-1098\"\/><\/figure>\n\n\n\n<p>\u63a8\u9001\u955c\u50cf\u5230\u955c\u50cf\u4ed3\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker login dockerhub.gpst.net.cn\nchmod +x rancher-load-images.sh<\/code><\/pre>\n\n\n\n<p>\u767b\u5f55Harbor WEB UI\uff1a<\/p>\n\n\n\n<p>\u65b0\u5efa\u9879\u76ee\uff1arancher\u548cquay.io<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1917\" height=\"983\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/ScreenShot_2026-07-07_145644_263.png\" alt=\"\" class=\"wp-image-1100\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1646\" height=\"450\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/ScreenShot_2026-07-07_145742_981.png\" alt=\"\" class=\"wp-image-1102\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/rancher-load-images.sh --image-list .\/rancher-images.txt --registry dockerhub.gpst.net.cn<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1356\" height=\"585\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/ScreenShot_2026-07-07_145956_437.png\" alt=\"\" class=\"wp-image-1104\"\/><\/figure>\n\n\n\n<p>\u4e09\u3001\u5b89\u88c5Kubernets\u96c6\u7fa4<\/p>\n\n\n\n<p>\u5728\u53ef\u4ee5\u8bbf\u95ee\u4f60\u7684 Linux \u8282\u70b9\u4e0a\u7684 22\/tcp \u7aef\u53e3\u548c 6443\/tcp \u7aef\u53e3\u7684\u7cfb\u7edf\u4e0a\uff08\u9009\u62e9Nginx\u8fd9\u53f0\u670d\u52a1\u5668\uff09<\/p>\n\n\n\n<p>\u5b89\u88c5rke\uff0c\u7248\u672c\u4e3av1.2.23 \uff08\u517c\u5bb9rancher v2.5.17\uff09<\/p>\n\n\n\n<p><a href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/rke_linux-amd64\">rke<\/a> \uff08\u672c\u7ad9\u4e0b\u8f7d\u5730\u5740\uff09<\/p>\n\n\n\n<p><a href=\"https:\/\/rancher-mirror.rancher.cn\/rke\/v1.2.23\/rke_linux-amd64\">rke<\/a>\uff08\u4e0b\u8f7d\u5730\u57402\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv rke_linux-amd64 \/usr\/local\/bin\/rke\nchmod +x \/usr\/local\/bin\/rke<\/code><\/pre>\n\n\n\n<p>\u914d\u7f6eSSH\u5bc6\u94a5\u5206\u53d1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat &gt;&gt; \/etc\/hosts &lt;&lt;EOF\n192.168.1.170 rancher-1 r1\n192.168.1.171 rancher-2 r2\n192.168.1.172 rancher-3 r3\nEOF\n\nssh-keygen\n\u4e00\u8def\u56de\u8f66\nfor ((i=1;i&lt;=3;i++));do ssh-copy-id root@r${i};done\n\u5faa\u73af\u8f93\u5165yes\u548c\u5bc6\u7801\n<\/code><\/pre>\n\n\n\n<p>\u521b\u5efarke\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p>RKE \u9009\u9879<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u9009\u9879<\/th><th>\u662f\u5426\u5fc5\u9009<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td><code>address<\/code><\/td><td>\u662f<\/td><td>\u79bb\u7ebf\u73af\u5883\u4e2d\u8282\u70b9\u7684 DNS \u6216 IP<\/td><\/tr><tr><td><code>user<\/code><\/td><td>\u662f<\/td><td>\u53ef\u4ee5\u5728\u8282\u70b9\u4e0a\u6267\u884c docker \u547d\u4ee4\u7684\u7528\u6237<\/td><\/tr><tr><td><code>role<\/code><\/td><td>\u5426<\/td><td>\u60f3\u8981\u7ed9\u8282\u70b9\u5206\u914d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a Kubernetes \u89d2\u8272<\/td><\/tr><tr><td><code>internal_address<\/code><\/td><td>\u5426<sup>1<\/sup><\/td><td>\u79bb\u7ebf\u73af\u5883\u4e2d\u8282\u70b9\u7684\u5185\u90e8 DNS \u6216\u5185\u7f51 IP<\/td><\/tr><tr><td><code>ssh_key_path<\/code><\/td><td>\u5426<\/td><td>\u7528\u6765\u767b\u5f55\u8282\u70b9\u7684 SSH \u79c1\u94a5\u6587\u4ef6\u8def\u5f84\uff08\u9ed8\u8ba4\u503c\u4e3a<code>~\/.ssh\/id_rsa<\/code>\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>rancher-cluster.yml:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nodes:\n  - address: 192.168.1.170\n    user: root\n    role: &#91;\"controlplane\", \"etcd\", \"worker\"]\n    ssh_key_path: \/root\/.ssh\/id_rsa\n  - address: 192.168.1.171\n    user: root\n    role: &#91;\"controlplane\", \"etcd\", \"worker\"]\n    ssh_key_path: \/root\/.ssh\/id_rsa\n  - address: 192.168.1.172\n    user: root\n    role: &#91;\"controlplane\", \"etcd\", \"worker\"]\n    ssh_key_path: \/root\/.ssh\/id_rsa\n\nprivate_registries:\n  - url: dockerhub.gpst.net.cn\n    user: admin\n    password: \"Harbor12345\"\n    is_default: true<\/code><\/pre>\n\n\n\n<p>\u6267\u884crke<\/p>\n\n\n\n<p>\u914d\u7f6e\u5b8c<code>rancher-cluster.yml<\/code>\u4e4b\u540e\uff0c\u542f\u52a8\u4f60\u7684 Kubernetes \u96c6\u7fa4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rke up --config .\/rancher-cluster.yml<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6709\u5173\u4e8ekube-apiserver\u7684\u8b66\u544a\u6682\u65f6\u4e0d\u5fc5\u7406\u4f1a\uff0c\u7b49kube-apiserver\u5bb9\u5668\u542f\u52a8\u5b8c\u6210\u4e86\uff0c\u8b66\u544a\u81ea\u52a8\u4f1a\u6d88\u5931\u3002<\/li>\n\n\n\n<li>\u6709\u9519\u8bef\uff0c\u53ef\u4ee5\u518d\u91cd\u590d\u6267\u884c\u4e00\u6b21\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\u80fd\u81ea\u52a8\u89e3\u51b3\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5c06\u4ee5\u4e0b\u6587\u4ef6\u7684\u526f\u672c\u4fdd\u5b58\u5728\u5b89\u5168\u7684\u4f4d\u7f6e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>rancher-cluster.yml<\/code>\uff1aRKE \u914d\u7f6e\u6587\u4ef6<\/li>\n\n\n\n<li><code>kube_config_rancher-cluster.yml<\/code>\uff1a\u96c6\u7fa4\u7684&nbsp;Kubeconfig \u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u5305\u542b\u5bf9\u96c6\u7fa4\u7684\u5b8c\u5168\u8bbf\u95ee\u6743\u9650\u7684\u51ed\u636e\u3002<\/li>\n\n\n\n<li><code>rancher-cluster.rkestate<\/code>\uff1aKubernetes \u96c6\u7fa4\u72b6\u6001\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u5305\u542b\u96c6\u7fa4\u7684\u5f53\u524d\u72b6\u6001\uff0c\u5305\u62ec RKE \u914d\u7f6e\u548c\u8bc1\u4e66\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5b89\u88c5kubectl<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -LO https:\/\/dl.k8s.io\/release\/v1.20.15\/bin\/linux\/amd64\/kubectl\nmv kubectl \/usr\/local\/bin\nchmod +x \/usr\/local\/bin\/kubectl\n<\/code><\/pre>\n\n\n\n<p>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \/root\/.kube\ncp .\/<span style=\"background-color: rgba(0, 0, 0, 0.2); font-family: inherit; font-size: inherit; text-align: initial; color: initial;\"><span style=\"background-color: rgba(0, 0, 0, 0.2); font-family: inherit; font-size: inherit; text-align: initial; color: initial;\">kube_config_rancher-cluster.yml<\/span><\/span> \/root\/.kube\/config\nchmod 600 \/root\/.kube\/config<\/code><\/pre>\n\n\n\n<p>\u68c0\u9a8c\u96c6\u7fa4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get node<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"108\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/ScreenShot_2026-07-07_155618_787.png\" alt=\"\" class=\"wp-image-1118\"\/><\/figure>\n\n\n\n<p>\u56db\u3001\u5b89\u88c5cert-manager<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>helm repo add jetstack https:\/\/charts.jetstack.io\nhelm repo update\nkubectl create namespace cert-manager<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>helm install cert-manager jetstack\/cert-manager --version v1.5.1 --namespace cert-manager --set installCRDs=true<\/code><\/pre>\n\n\n\n<p>\u6216\u8005<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>helm fetch jetstack\/cert-manager --version=v1.5.1\n\ncurl -L -o cert-manager-crd.yaml https:\/\/github.com\/cert-manager\/cert-manager\/releases\/download\/v1.5.1\/cert-manager.crds.yaml\n\nkubectl apply -f .\/cert-manager-crd.yaml\n\nhelm install cert-manager .\/cert-manager-v1.5.1.tgz     --namespace cert-manager     --set image.repository=dockerhub.gpst.net.cn\/quay.io\/jetstack\/cert-manager-controller     --set webhook.image.repository=dockerhub.gpst.net.cn\/quay.io\/jetstack\/cert-manager-webhook     --set cainjector.image.repository=dockerhub.gpst.net.cn\/quay.io\/jetstack\/cert-manager-cainjector     --set startupapicheck.image.repository=dockerhub.gpst.net.cn\/quay.io\/jetstack\/cert-manager-ctl<\/code><\/pre>\n\n\n\n<p>\u4e94\u3001\u5b89\u88c5rancher<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>helm repo add rancher-stable https:\/\/releases.rancher.com\/server-charts\/stable\nhelm repo update\nhelm fetch rancher-stable\/rancher --version=v2.5.17\nhelm install rancher .\/rancher-2.5.17.tgz     --namespace cattle-system     --set hostname=kubelb.gpst.net.cn     --set certmanager.version=1.5.1     --set rancherImage=dockerhub.gpst.net.cn\/rancher\/rancher     --set systemDefaultRegistry=dockerhub.gpst.net.cn     --set useBundledSystemChart=true\n<\/code><\/pre>\n\n\n\n<p>\u68c0\u9a8crancher\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get all -o wide -n cattle-system<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2430\" height=\"426\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/ScreenShot_2026-07-07_162509_209.png\" alt=\"\" class=\"wp-image-1122\"\/><\/figure>\n\n\n\n<p>rancher\u7684WEB UI\u754c\u9762\uff1a\uff08https:\/\/kubelb.gpst.net.cn\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"945\" src=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/07\/png.jpg\" alt=\"\" class=\"wp-image-1124\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u914d\u7f6e\u57fa\u7840\u8bbe\u65bd\u548c\u79c1\u6709\u955c\u50cf\u4ed3\u5e93 \u5728 RKE \u96c6\u7fa4\u4e2d\u5b89\u88c5 Rancher \u9ad8\u53ef\u7528\uff0c\u6211\u4eec\u5efa\u8bae\u4e3a\u9ad8\u53ef\u7528\u5b89\u88c5\u914d\u7f6e\u4ee5\u4e0b\u57fa\u7840\u8bbe\u65bd\uff1a \u89d2\u8272 ip\u5730\u5740 \u64cd\u4f5c\u7cfb\u7edf controlplane\/worker\/etcd 192.168.1.170 CentOS Linux release 8.4.2105 controlplane\/worker\/etcd 192.168.1.171 CentOS Linux release 8.4.2105 controlplane\/worker\/etcd 192.168.1.172 CentOS Linux release 8.4.2105 Harbor\uff08\u79c1\u6709docker\u955c\u50cf\u4ed3\u5e93\uff09 192.168.1.178 CentOS Linux release 8.4.2105 Nginx\uff08\u8d1f\u8f7d\u5747\u8861\u5668\uff09 192.168.1.179 CentOS Linux release 8.4.2105 \u6bcf\u4e2a\u670d\u52a1\u5668\u6267\u884c\u6807\u51c6\u521d\u59cb\u5316\uff1a init_centos8.sh: 1\u3001\u5b89\u88c5Harbor\uff08\u79c1\u7f51docker\u955c\u50cf\u4ed3\u5e93\uff09 harbor.yml\u4fee\u6539\u4e09\u5904\u4e3a\u5b9e\u9645\u8bbe\u7f6e\uff1a \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5373\u53ef\u901a\u8fc7dockerhub.gpst.net.cn\u8bbf\u95ee\u79c1\u7f51docker\u955c\u50cf\u4ed3\u5e93\uff0c\u9ed8\u8ba4\u7684\u7528\u6237\u540d\/\u5bc6\u7801: admin\/Harbor12345 2\u3001\u5b89\u88c5Nginx\uff08\u8d1f\u8f7d\u5747\u8861\u5668\uff09 \u4e8c\u3001\u540c\u6b65\u955c\u50cf\u5230\u79c1\u6709\u4ed3\u5e93 \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cRancher \u4e2d\u6240\u6709\u7528\u4e8e\u521b\u5efa Kubernetes \u96c6\u7fa4\u6216\u542f\u52a8 Rancher \u4e2d\u4efb\u4f55\u5de5\u5177\uff08\u5982\u76d1\u63a7\u548c\u65e5\u5fd7\uff09\u7684\u955c\u50cf\u90fd\u6765\u81ea Docker Hub\u3002\u5728 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1068","post","type-post","status-publish","format-standard","hentry","category-dockerkubernetes"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/1068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1068"}],"version-history":[{"count":24,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/1068\/revisions"}],"predecessor-version":[{"id":1142,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/1068\/revisions\/1142"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}