{"id":65483,"date":"2026-01-25T02:16:34","date_gmt":"2026-01-24T18:16:34","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/65483.html"},"modified":"2026-01-25T02:16:34","modified_gmt":"2026-01-24T18:16:34","slug":"%e5%9f%ba%e4%ba%8ekubeadm%e9%83%a8%e7%bd%b2kubernetes-1-29%e9%9b%86%e7%be%a4%ef%bc%88centos-7-9%e6%9c%80%e7%bb%88%e7%89%88%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/65483.html","title":{"rendered":"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09"},"content":{"rendered":"<h2>\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4&#xff08;CentOS 7.9\u6700\u7ec8\u7248&#xff09;<\/h2>\n<h2>\u4e00\u3001\u73af\u5883\u51c6\u5907<\/h2>\n<h3>1.1 \u64cd\u4f5c\u7cfb\u7edf\u8981\u6c42<\/h3>\n<p>\u64cd\u4f5c\u7cfb\u7edf&#xff1a;CentOS 7.9&#xff08;\u6700\u5c0f\u5316\u5b89\u88c5&#xff0c;\u5df2\u914d\u7f6e\u57fa\u7840\u7f51\u7edc&#xff09;<\/p>\n<p>\u5185\u6838\u8981\u6c42&#xff1a;3.10.0-1160.el7.x86_64\u53ca\u4ee5\u4e0a&#xff08;\u6267\u884cuname -r\u9a8c\u8bc1&#xff0c;\u4f4e\u4e8e\u6b64\u7248\u672c\u9700\u5347\u7ea7\u5185\u6838&#xff09;<\/p>\n<h3>1.2 \u96c6\u7fa4\u89c4\u5212<\/h3>\n<table>\n<tr>\u4e3b\u673a\u540dIP\u5730\u5740\u5185\u5b58\u786c\u76d8\u89d2\u8272<\/tr>\n<tbody>\n<tr>\n<td>k8s-master<\/td>\n<td>192.168.56.100<\/td>\n<td>4G\u53ca\u4ee5\u4e0a<\/td>\n<td>50G\u53ca\u4ee5\u4e0a<\/td>\n<td>Master\u8282\u70b9<\/td>\n<\/tr>\n<tr>\n<td>k8s-worker-01<\/td>\n<td>192.168.56.101<\/td>\n<td>4G\u53ca\u4ee5\u4e0a<\/td>\n<td>50G\u53ca\u4ee5\u4e0a<\/td>\n<td>Worker\u8282\u70b9<\/td>\n<\/tr>\n<tr>\n<td>k8s-worker-02<\/td>\n<td>192.168.56.102<\/td>\n<td>4G\u53ca\u4ee5\u4e0a<\/td>\n<td>50G\u53ca\u4ee5\u4e0a<\/td>\n<td>Worker\u8282\u70b9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>1.3 \u8f6f\u4ef6\u7248\u672c\u6e05\u5355<\/h3>\n<table>\n<tr>\u8f6f\u4ef6\u540d\u79f0\u7248\u672c\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>Kubernetes<\/td>\n<td>1.29.0<\/td>\n<td>\u6838\u5fc3\u96c6\u7fa4\u7ec4\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>Docker CE<\/td>\n<td>26.1.4<\/td>\n<td>\u5bb9\u5668\u8fd0\u884c\u65f6&#xff08;\u9700\u9501\u5b9a\u7248\u672c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>cri-dockerd<\/td>\n<td>0.3.8<\/td>\n<td>Docker\u4e0eK8s\u7684\u9002\u914d\u6865\u6881<\/td>\n<\/tr>\n<tr>\n<td>Calico<\/td>\n<td>3.24.1<\/td>\n<td>\u5bb9\u5668\u7f51\u7edc\u63d2\u4ef6&#xff08;\u9002\u914d10.244.0.0\/16\u7f51\u6bb5&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e8c\u3001\u6240\u6709\u8282\u70b9\u57fa\u7840\u914d\u7f6e&#xff08;\u5fc5\u6267\u884c&#xff09;<\/h2>\n<p>\u8bf4\u660e&#xff1a;\u4ee5\u4e0b\u64cd\u4f5c\u9700\u5728Master\u548c\u6240\u6709Worker\u8282\u70b9\u6267\u884c&#xff0c;\u5efa\u8bae\u4f7f\u7528root\u7528\u6237\u64cd\u4f5c&#xff0c;\u907f\u514d\u6743\u9650\u95ee\u9898\u3002<\/p>\n<h3>2.1 \u4e3b\u673a\u540d\u914d\u7f6e<\/h3>\n<h4>Master\u8282\u70b9<\/h4>\n<p>hostnamectl set-hostname k8s-master <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token function\">bash<\/span><\/p>\n<h4>Worker01\u8282\u70b9<\/h4>\n<p>hostnamectl set-hostname k8s-worker-01 <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token function\">bash<\/span><\/p>\n<h4>Worker02\u8282\u70b9<\/h4>\n<p>hostnamectl set-hostname k8s-worker-02 <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token function\">bash<\/span><\/p>\n<h3>2.2 \u4e3b\u673a\u540d\u6620\u5c04<\/h3>\n<p><span class=\"token function\">vi<\/span> \/etc\/hosts<\/p>\n<p>\u65b0\u589e\u4ee5\u4e0b\u5185\u5bb9&#xff08;\u6240\u6709\u8282\u70b9\u4e00\u81f4&#xff09;&#xff1a;<\/p>\n<p>192.168.56.100 k8s-master<br \/>\n192.168.56.101 k8s-worker-01<br \/>\n192.168.56.102 k8s-worker-02<\/p>\n<p>\u9a8c\u8bc1&#xff1a;\u6267\u884cping k8s-master&#xff0c;\u80fd\u6b63\u5e38\u8fde\u901a\u5373\u53ef\u3002<\/p>\n<h3>2.3 \u5173\u95ed\u9632\u706b\u5899<\/h3>\n<p><span class=\"token comment\"># \u5173\u95ed\u5e76\u7981\u7528\u9632\u706b\u5899<\/span><br \/>\nsystemctl disable firewalld <span class=\"token operator\">&amp;&amp;<\/span> systemctl stop firewalld<br \/>\n<span class=\"token comment\"># \u9a8c\u8bc1\u72b6\u6001&#xff08;\u8f93\u51fanot running&#xff09;<\/span><br \/>\nfirewall-cmd &#8211;state<\/p>\n<h3>2.4 \u5173\u95edSELinux<\/h3>\n<p><span class=\"token comment\"># \u4e34\u65f6\u5173\u95ed<\/span><br \/>\nsetenforce <span class=\"token number\">0<\/span><br \/>\n<span class=\"token comment\"># \u6c38\u4e45\u5173\u95ed&#xff08;\u4fee\u6539\u914d\u7f6e\u6587\u4ef6&#xff09;<\/span><br \/>\n<span class=\"token function\">sed<\/span> -i <span class=\"token string\">&#034;s\/SELINUX&#061;enforcing\/SELINUX&#061;disabled\/g&#034;<\/span> \/etc\/selinux\/config<br \/>\n<span class=\"token comment\"># \u91cd\u542f\u7cfb\u7edf\u751f\u6548&#xff08;\u5fc5\u987b\u91cd\u542f&#xff09;<\/span><br \/>\n<span class=\"token function\">reboot<\/span><\/p>\n<p>\u91cd\u542f\u540e\u9a8c\u8bc1&#xff1a;\u6267\u884csestatus&#xff0c;\u8f93\u51faSELinux status: disabled\u5373\u53ef\u3002<\/p>\n<h3>2.5 \u914d\u7f6e\u53ef\u7528yum\u6e90&#xff08;\u89e3\u51b3\u955c\u50cf\u6e90\u89e3\u6790\u5931\u8d25\u95ee\u9898&#xff09;<\/h3>\n<p>\u8bf4\u660e&#xff1a;\u5148\u4fee\u590dyum\u6e90&#xff0c;\u907f\u514d\u56e0\u65e0\u6cd5\u89e3\u6790\u955c\u50cf\u6e90\u5bfc\u81f4\u5b89\u88c5\u5931\u8d25&#xff0c;\u9002\u914dCentOS 7\u7cfb\u7edf\u3002<\/p>\n<p><span class=\"token comment\"># 1. \u5220\u9664\u539f\u6709\u65e0\u6548yum\u6e90<\/span><br \/>\n<span class=\"token function\">rm<\/span> -rf \/etc\/yum.repos.d\/*<\/p>\n<p><span class=\"token comment\"># 2. \u914d\u7f6e\u963f\u91cc\u4e91CentOS 7\u53ef\u7528yum\u6e90&#xff08;\u56fd\u5185\u7a33\u5b9a&#xff09;<\/span><br \/>\n<span class=\"token function\">curl<\/span> -o \/etc\/yum.repos.d\/CentOS-Base.repo https:\/\/mirrors.aliyun.com\/repo\/Centos-7.repo<\/p>\n<p><span class=\"token comment\"># 3. \u6e05\u7406\u65e0\u6548\u955c\u50cf\u5730\u5740&#xff0c;\u4fdd\u7559\u53ef\u7528\u8282\u70b9<\/span><br \/>\n<span class=\"token function\">sed<\/span> -i -e <span class=\"token string\">&#039;\/mirrors.cloud.aliyuncs.com\/d&#039;<\/span> -e <span class=\"token string\">&#039;\/mirrors.aliyuncs.com\/d&#039;<\/span> \/etc\/yum.repos.d\/CentOS-Base.repo<\/p>\n<p><span class=\"token comment\"># 4. \u751f\u6210yum\u7f13\u5b58&#xff0c;\u66f4\u65b0\u6e90\u7d22\u5f15<\/span><br \/>\nyum clean all <span class=\"token operator\">&amp;&amp;<\/span> yum makecache<\/p>\n<p><span class=\"token comment\"># 5. \u9a8c\u8bc1yum\u6e90\u662f\u5426\u53ef\u7528&#xff08;\u65e0\u62a5\u9519\u5373\u6b63\u5e38&#xff09;<\/span><br \/>\nyum repolist<\/p>\n<h3>2.6 \u65f6\u95f4\u540c\u6b65\u914d\u7f6e&#xff08;\u5f7b\u5e95\u6e05\u7406&#043;\u5168\u65b0\u90e8\u7f72&#xff09;<\/h3>\n<p>\u8bf4\u660e&#xff1a;\u57fa\u4e8e\u53ef\u7528yum\u6e90&#xff0c;\u5f7b\u5e95\u6e05\u7406\u539f\u6709chrony\u6b8b\u7559&#xff0c;\u5168\u65b0\u5b89\u88c5\u914d\u7f6e&#xff0c;\u9002\u914d\u96c6\u7fa4192.168.56.0\/24\u7f51\u6bb5\u3002<\/p>\n<h4>\u7b2c\u4e00\u6b65&#xff1a;\u5f7b\u5e95\u5378\u8f7d\u5e76\u6e05\u7406chrony\u6b8b\u7559\u6587\u4ef6<\/h4>\n<p><span class=\"token comment\"># 1. \u505c\u6b62chronyd\u670d\u52a1<\/span><br \/>\nsystemctl stop chronyd<\/p>\n<p><span class=\"token comment\"># 2. \u7981\u7528chronyd\u5f00\u673a\u81ea\u542f<\/span><br \/>\nsystemctl disable chronyd<\/p>\n<p><span class=\"token comment\"># 3. \u5f7b\u5e95\u5378\u8f7dchrony<\/span><br \/>\nyum remove -y chrony<\/p>\n<p><span class=\"token comment\"># 4. \u5220\u9664\u6b8b\u7559\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">rm<\/span> -rf \/etc\/chrony.conf \/var\/lib\/chrony\/*<\/p>\n<p><span class=\"token comment\"># 5. \u6e05\u7406\u76f8\u5173\u65e5\u5fd7&#xff08;\u9002\u914dCentOS 7&#xff09;<\/span><br \/>\nsystemctl restart systemd-journald<br \/>\njournalctl &#8211;vacuum-time<span class=\"token operator\">&#061;<\/span>1s<\/p>\n<h4>\u7b2c\u4e8c\u6b65&#xff1a;\u91cd\u65b0\u5b89\u88c5\u5e76\u914d\u7f6echrony<\/h4>\n<p><span class=\"token comment\"># 1. \u91cd\u65b0\u5b89\u88c5chrony<\/span><br \/>\nyum <span class=\"token function\">install<\/span> -y chrony<\/p>\n<p><span class=\"token comment\"># 2. \u76f4\u63a5\u521b\u5efa\u5e72\u51c0\u7684chrony.conf\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/etc\/chrony.conf <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">EOF<br \/>\n# \u963f\u91cc\u4e91NTP\u670d\u52a1\u5668&#xff08;\u591a\u914d\u7f6e\u63d0\u9ad8\u53ef\u7528\u6027&#xff09;<br \/>\nserver ntp1.aliyun.com iburst<br \/>\nserver ntp2.aliyun.com iburst<br \/>\nserver ntp3.aliyun.com iburst<br \/>\nserver ntp4.aliyun.com iburst<\/p>\n<p># \u5141\u8bb8192.168.56.0\/24\u7f51\u6bb5\u8282\u70b9\u540c\u6b65\u65f6\u95f4<br \/>\nallow 192.168.56.0\/24<\/p>\n<p># \u65e0\u6cd5\u8fde\u63a5\u5916\u90e8NTP\u65f6&#xff0c;\u4f7f\u7528\u672c\u5730\u65f6\u95f4\u5907\u7528<br \/>\nlocal stratum 10<\/p>\n<p># \u65e5\u5fd7\u76f8\u5173\u914d\u7f6e<br \/>\nlogdir \/var\/log\/chrony<br \/>\nlog measurements statistics tracking<br \/>\nEOF<\/span><\/p>\n<p><span class=\"token comment\"># 3. \u542f\u52a8chronyd\u670d\u52a1\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<\/span><br \/>\nsystemctl start chronyd<br \/>\nsystemctl <span class=\"token builtin class-name\">enable<\/span> chronyd<\/p>\n<h4>\u7b2c\u4e09\u6b65&#xff1a;\u9a8c\u8bc1\u90e8\u7f72\u7ed3\u679c<\/h4>\n<p><span class=\"token comment\"># 1. \u67e5\u770bchronyd\u670d\u52a1\u72b6\u6001&#xff08;active (running)\u5373\u6b63\u5e38&#xff09;<\/span><br \/>\nsystemctl status chronyd -l<\/p>\n<p><span class=\"token comment\"># 2. \u67e5\u770bNTP\u670d\u52a1\u5668\u8fde\u63a5\u72b6\u6001&#xff08;*\u53f7\u8868\u793a\u5df2\u540c\u6b65&#xff09;<\/span><br \/>\nchronyc sources -v<\/p>\n<p><span class=\"token comment\"># 3. \u624b\u52a8\u89e6\u53d1\u65f6\u95f4\u540c\u6b65<\/span><br \/>\nchronyc makestep<\/p>\n<p><span class=\"token comment\"># 4. \u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4<\/span><br \/>\n<span class=\"token function\">date<\/span><\/p>\n<h3>2.7 \u5185\u6838\u53c2\u6570\u914d\u7f6e&#xff08;\u8def\u7531\u8f6c\u53d1&#043;\u7f51\u6865\u8fc7\u6ee4&#xff09;<\/h3>\n<p><span class=\"token comment\"># \u521b\u5efa\u5185\u6838\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/etc\/sysctl.d\/k8s.conf <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">EOF<br \/>\nnet.bridge.bridge-nf-call-iptables &#061; 1<br \/>\nnet.bridge.bridge-nf-call-ip6tables &#061; 1<br \/>\nnet.ipv4.ip_forward &#061; 1<br \/>\nvm.swappiness &#061; 0  # \u7981\u6b62\u4f7f\u7528swap\u5206\u533a<br \/>\nEOF<\/span><br \/>\n<span class=\"token comment\"># \u751f\u6548\u5185\u6838\u53c2\u6570<\/span><br \/>\nsysctl &#8211;system<br \/>\n<span class=\"token comment\"># \u52a0\u8f7dbr_netfilter\u6a21\u5757<\/span><br \/>\nmodprobe br_netfilter<br \/>\n<span class=\"token comment\"># \u9a8c\u8bc1\u6a21\u5757\u52a0\u8f7d&#xff08;\u6709\u8f93\u51fa\u5373\u6210\u529f&#xff09;<\/span><br \/>\nlsmod <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> br_netfilter<\/p>\n<h3>2.8 IPVS\u8f6c\u53d1\u914d\u7f6e<\/h3>\n<p><span class=\"token comment\"># \u5b89\u88c5ipvsadm\u5de5\u5177<\/span><br \/>\nyum <span class=\"token function\">install<\/span> -y ipvsadm<br \/>\n<span class=\"token comment\"># \u521b\u5efa\u6a21\u5757\u52a0\u8f7d\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">mkdir<\/span> -p \/etc\/sysconfig\/ipvsadm<br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/etc\/sysconfig\/ipvsadm\/ipvs.modules <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">EOF<br \/>\n#!\/bin\/bash<br \/>\nmodprobe &#8212; ip_vs<br \/>\nmodprobe &#8212; ip_vs_rr<br \/>\nmodprobe &#8212; ip_vs_wrr<br \/>\nmodprobe &#8212; ip_vs_sh<br \/>\nmodprobe &#8212; nf_conntrack_ipv4  # CentOS 7\u5185\u6838\u9002\u914d<br \/>\nEOF<\/span><br \/>\n<span class=\"token comment\"># \u6388\u6743\u5e76\u6267\u884c\u6a21\u5757\u52a0\u8f7d<\/span><br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">755<\/span> \/etc\/sysconfig\/ipvsadm\/ipvs.modules <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token function\">bash<\/span> \/etc\/sysconfig\/ipvsadm\/ipvs.modules<br \/>\n<span class=\"token comment\"># \u9a8c\u8bc1\u52a0\u8f7d&#xff08;\u6709\u5bf9\u5e94\u8f93\u51fa\u5373\u6210\u529f&#xff09;<\/span><br \/>\nlsmod <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> -e ip_vs -e nf_conntrack<\/p>\n<h3>2.9 \u5173\u95edSwap\u5206\u533a<\/h3>\n<p><span class=\"token comment\"># \u4e34\u65f6\u5173\u95edswap<\/span><br \/>\nswapoff -a<br \/>\n<span class=\"token comment\"># \u6c38\u4e45\u5173\u95ed&#xff08;\u6ce8\u91caswap\u76f8\u5173\u884c&#xff09;<\/span><br \/>\n<span class=\"token function\">sed<\/span> -i <span class=\"token string\">&#039;\/swap\/s\/^\/#\/&#039;<\/span> \/etc\/fstab<br \/>\n<span class=\"token comment\"># \u9a8c\u8bc1&#xff08;\u65e0\u8f93\u51fa\u5373\u6210\u529f&#xff09;<\/span><br \/>\n<span class=\"token function\">grep<\/span> swap \/etc\/fstab<\/p>\n<h2>\u4e09\u3001\u6240\u6709\u8282\u70b9\u5b89\u88c5Docker\u4e0ecri-dockerd<\/h2>\n<h3>3.1 \u5b89\u88c5Docker CE 26.1.4<\/h3>\n<p><span class=\"token comment\"># \u5b89\u88c5\u4f9d\u8d56\u5de5\u5177<\/span><br \/>\nyum <span class=\"token function\">install<\/span> -y yum-utils device-mapper-persistent-data lvm2 <span class=\"token function\">vim<\/span> net-tools <span class=\"token function\">wget<\/span><br \/>\n<span class=\"token comment\"># \u914d\u7f6e\u963f\u91cc\u4e91Docker yum\u6e90<\/span><br \/>\nyum-config-manager &#8211;add-repo https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo<br \/>\n<span class=\"token function\">sed<\/span> -i <span class=\"token string\">&#039;s&#043;download.docker.com&#043;mirrors.aliyun.com\/docker-ce&#043;&#039;<\/span> \/etc\/yum.repos.d\/docker-ce.repo<br \/>\n<span class=\"token comment\"># \u5b89\u88c5\u6307\u5b9a\u7248\u672cDocker&#xff08;\u4ec5\u5b89\u88c5docker-ce&#xff0c;\u9501\u5b9a26.1.4&#xff09;<\/span><br \/>\nyum <span class=\"token function\">install<\/span> -y docker-ce-26.1.4<\/p>\n<h3>3.2 \u914d\u7f6eDocker\u955c\u50cf\u6e90<\/h3>\n<p>\u8bf4\u660e&#xff1a;\u4ec5\u914d\u7f6e\u6307\u5b9a\u955c\u50cf\u6e90&#xff0c;\u65e0\u989d\u5916\u5197\u4f59\u914d\u7f6e&#xff0c;\u786e\u4fddDocker\u7a33\u5b9a\u542f\u52a8\u3002<\/p>\n<p><span class=\"token comment\"># \u66f4\u6362\u6e90&#xff08;\u4f7f\u7528\u6307\u5b9a\u955c\u50cf\u5217\u8868&#xff09;<\/span><br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/etc\/docker\/daemon.json <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">EOF<br \/>\n {<br \/>\n  &#034;registry-mirrors&#034;: [<br \/>\n    &#034;https:\/\/docker.hpcloud.cloud&#034;,<br \/>\n    &#034;https:\/\/docker.m.daocloud.io&#034;,<br \/>\n    &#034;https:\/\/docker.unsee.tech&#034;,<br \/>\n    &#034;https:\/\/docker.1panel.live&#034;,<br \/>\n    &#034;http:\/\/mirrors.ustc.edu.cn&#034;,<br \/>\n    &#034;https:\/\/docker.chenby.cn&#034;,<br \/>\n    &#034;http:\/\/mirror.azure.cn&#034;,<br \/>\n    &#034;https:\/\/dockerpull.org&#034;,<br \/>\n    &#034;https:\/\/dockerhub.icu&#034;,<br \/>\n    &#034;https:\/\/hub.rat.dev&#034;,<br \/>\n    &#034;https:\/\/proxy.1panel.live&#034;,<br \/>\n    &#034;https:\/\/docker.1panel.top&#034;,<br \/>\n    &#034;https:\/\/docker.1ms.run&#034;,<br \/>\n    &#034;https:\/\/docker.ketches.cn&#034;<br \/>\n  ]<br \/>\n}<br \/>\nEOF<\/span><\/p>\n<p><span class=\"token comment\"># \u91cd\u542fDocker\u4f7f\u914d\u7f6e\u751f\u6548\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<\/span><br \/>\nsystemctl daemon-reload<br \/>\nsystemctl restart <span class=\"token function\">docker<\/span><br \/>\nsystemctl <span class=\"token builtin class-name\">enable<\/span> <span class=\"token function\">docker<\/span><\/p>\n<p><span class=\"token comment\"># \u9a8c\u8bc1Docker\u72b6\u6001&#xff08;active (running)\u5373\u6210\u529f&#xff09;<\/span><br \/>\nsystemctl status <span class=\"token function\">docker<\/span> -l<\/p>\n<h3>3.3 \u5b89\u88c5cri-dockerd 0.3.8<\/h3>\n<p><span class=\"token comment\"># \u4e0b\u8f7dcri-dockerd RPM\u5305<\/span><br \/>\n<span class=\"token function\">wget<\/span> https:\/\/github.com\/Mirantis\/cri-dockerd\/releases\/download\/v0.3.8\/cri-dockerd-0.3.8-3.el7.x86_64.rpm<br \/>\n<span class=\"token comment\"># \u5b89\u88c5cri-dockerd<\/span><br \/>\nyum -y <span class=\"token function\">install<\/span> cri-dockerd-0.3.8-3.el7.x86_64.rpm<br \/>\n<span class=\"token comment\"># \u4fee\u6539cri-docker\u670d\u52a1\u914d\u7f6e&#xff08;\u9002\u914d\u56fd\u5185pause\u955c\u50cf&#xff09;<\/span><br \/>\n<span class=\"token function\">sed<\/span> -i <span class=\"token string\">&#039;s#^ExecStart&#061;\/usr\/bin\/cri-dockerd &#8211;container-runtime-endpoint fd:\/\/#ExecStart&#061;\/usr\/bin\/cri-dockerd &#8211;pod-infra-container-image&#061;registry.aliyuncs.com\/google_containers\/pause:3.9 &#8211;container-runtime-endpoint fd:\/\/#g&#039;<\/span> \/usr\/lib\/systemd\/system\/cri-docker.service<br \/>\n<span class=\"token comment\"># \u91cd\u65b0\u52a0\u8f7d\u670d\u52a1\u914d\u7f6e\u5e76\u542f\u52a8<\/span><br \/>\nsystemctl daemon-reload <span class=\"token operator\">&amp;&amp;<\/span> systemctl start cri-docker <span class=\"token operator\">&amp;&amp;<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> cri-docker<br \/>\n<span class=\"token comment\"># \u9a8c\u8bc1\u72b6\u6001&#xff08;active (running)\u5373\u6210\u529f&#xff09;<\/span><br \/>\nsystemctl status cri-docker<\/p>\n<h2>\u56db\u3001\u6240\u6709\u8282\u70b9\u5b89\u88c5K8s\u7ec4\u4ef6&#xff08;kubelet\/kubeadm\/kubectl&#xff09;<\/h2>\n<p><span class=\"token comment\"># \u3010\u914d\u7f6ekubernetes\u7684yum\u6e90\u3011<\/span><br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&lt;&lt;<\/span><span class=\"token string\">EOF<span class=\"token bash punctuation\"> <span class=\"token operator\">|<\/span> <span class=\"token function\">tee<\/span> \/etc\/yum.repos.d\/kubernetes.repo<\/span><br \/>\n[kubernetes]<br \/>\nname&#061;Kubernetes<br \/>\nbaseurl&#061;https:\/\/mirrors.aliyun.com\/kubernetes-new\/core\/stable\/v1.29\/rpm\/<br \/>\nenabled&#061;1<br \/>\ngpgcheck&#061;1<br \/>\ngpgkey&#061;https:\/\/mirrors.aliyun.com\/kubernetes-new\/core\/stable\/v1.29\/rpm\/repodata\/repomd.xml.key<br \/>\nEOF<\/span><\/p>\n<p><span class=\"token comment\"># \u3010\u4f7f\u7528yum\u65b9\u5f0f\u5b89\u88c5\u3011<\/span><br \/>\nyum <span class=\"token function\">install<\/span> -y kubelet kubeadm kubectl<\/p>\n<p><span class=\"token comment\"># \u3010\u914d\u7f6e cgroup \u9a71\u52a8\u4e0edocker\u4e00\u81f4\u3011<\/span><br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/etc\/sysconfig\/kubelet <span class=\"token operator\">&lt;&lt;<\/span><span class=\"token string\">EOF<br \/>\nKUBELET_EXTRA_ARGS&#061;&#034;&#8211;cgroup-driver&#061;systemd&#034;<br \/>\nEOF<\/span><\/p>\n<p><span class=\"token comment\"># \u3010\u8bbe\u7f6ekubelet\u4e3a\u5f00\u673a\u81ea\u542f\u52a8\u3011<\/span><br \/>\nsystemctl daemon-reload <span class=\"token operator\">&amp;&amp;<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> kubelet<\/p>\n<h2>\u4e94\u3001\u96c6\u7fa4\u90e8\u7f72&#xff08;Master\u8282\u70b9\u6267\u884c\u6838\u5fc3\u64cd\u4f5c&#xff09;<\/h2>\n<h3>5.1 \u62c9\u53d6K8s\u6838\u5fc3\u955c\u50cf<\/h3>\n<p>\u521b\u5efa\u955c\u50cf\u62c9\u53d6\u811a\u672c&#xff0c;\u91c7\u7528\u6570\u7ec4\u5b58\u50a8\u955c\u50cf\u5217\u8868&#xff0c;\u907f\u514d\u89e3\u6790\u5f02\u5e38&#xff0c;\u9002\u914dbash\u73af\u5883&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u521b\u5efa\u811a\u672c&#xff08;\u6570\u7ec4\u5b58\u50a8\u955c\u50cf&#xff0c;\u89e3\u51b3\u89e3\u6790\u5f02\u5e38&#xff0c;\u589e\u5f3a\u62a5\u9519\u63d0\u793a&#xff09;<\/span><br \/>\n<span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> images_download_k8s.sh <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">EOF<br \/>\n#!\/bin\/bash<br \/>\n# \u963f\u91cc\u4e91\u955c\u50cf\u5217\u8868&#xff08;\u6570\u7ec4\u5b58\u50a8&#xff0c;\u5f7b\u5e95\u89e3\u51b3\u6362\u884c\/\u7a7a\u683c\u89e3\u6790\u95ee\u9898&#xff09;<br \/>\nimages_list&#061;(<br \/>\n&#034;registry.aliyuncs.com\/google_containers\/kube-apiserver:v1.29.0&#034;<br \/>\n&#034;registry.aliyuncs.com\/google_containers\/kube-controller-manager:v1.29.0&#034;<br \/>\n&#034;registry.aliyuncs.com\/google_containers\/kube-scheduler:v1.29.0&#034;<br \/>\n&#034;registry.aliyuncs.com\/google_containers\/kube-proxy:v1.29.0&#034;<br \/>\n&#034;registry.aliyuncs.com\/google_containers\/coredns:v1.11.1&#034;<br \/>\n&#034;registry.aliyuncs.com\/google_containers\/pause:3.9&#034;<br \/>\n&#034;registry.aliyuncs.com\/google_containers\/etcd:3.5.12-0&#034;<br \/>\n)<\/p>\n<p># \u5faa\u73af\u62c9\u53d6\u955c\u50cf&#xff08;\u6570\u7ec4\u904d\u5386&#xff0c;\u65e0\u89e3\u6790\u5f02\u5e38&#xff0c;\u62c9\u53d6\u5931\u8d25\u7acb\u5373\u9000\u51fa&#xff09;<br \/>\necho &#034;\u5f00\u59cb\u62c9\u53d6K8s\u6838\u5fc3\u955c\u50cf&#xff08;\u51717\u4e2a&#xff09;&#8230;&#034;<br \/>\nfor image in &#034;\\\\<span class=\"token variable\">${images_list<span class=\"token punctuation\">[<\/span>&#064;<span class=\"token punctuation\">]<\/span>}<\/span>&#034;<br \/>\ndo<br \/>\n    echo &#034;\u6b63\u5728\u62c9\u53d6&#xff1a;\\\\<span class=\"token variable\">$image<\/span>&#034;<br \/>\n    docker pull &#034;\\\\<span class=\"token variable\">$image<\/span>&#034;<br \/>\n    # \u62c9\u53d6\u5931\u8d25\u7acb\u5373\u9000\u51fa&#xff0c;\u660e\u786e\u62a5\u9519<br \/>\n    if [ \\\\<span class=\"token variable\">$?<\/span> -ne 0 ]; then<br \/>\n        echo &#034;ERROR&#xff1a;\u955c\u50cf\u62c9\u53d6\u5931\u8d25&#xff0c;\u8bf7\u68c0\u67e5\u7f51\u7edc\u6216\u955c\u50cf\u5730\u5740&#xff1a;\\\\<span class=\"token variable\">$image<\/span>&#034;<br \/>\n        exit 1<br \/>\n    fi<br \/>\ndone<\/p>\n<p># \u6807\u7b7e\u6620\u5c04&#xff08;\u9002\u914dK8s\u9ed8\u8ba4\u955c\u50cf\u540d\u79f0&#xff0c;\u786e\u4fdd\u5bf9\u5e94\u6b63\u786e&#xff09;<br \/>\necho -e &#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>\u5f00\u59cb\u914d\u7f6e\u955c\u50cf\u6807\u7b7e\u6620\u5c04&#8230;&#034;<br \/>\ndocker tag registry.aliyuncs.com\/google_containers\/kube-apiserver:v1.29.0 registry.k8s.io\/kube-apiserver:v1.29.0<br \/>\ndocker tag registry.aliyuncs.com\/google_containers\/kube-controller-manager:v1.29.0 registry.k8s.io\/kube-controller-manager:v1.29.0<br \/>\ndocker tag registry.aliyuncs.com\/google_containers\/kube-scheduler:v1.29.0 registry.k8s.io\/kube-scheduler:v1.29.0<br \/>\ndocker tag registry.aliyuncs.com\/google_containers\/kube-proxy:v1.29.0 registry.k8s.io\/kube-proxy:v1.29.0<br \/>\ndocker tag registry.aliyuncs.com\/google_containers\/etcd:3.5.12-0 registry.k8s.io\/etcd:3.5.12-0<br \/>\ndocker tag registry.aliyuncs.com\/google_containers\/coredns:v1.11.1 registry.k8s.io\/coredns\/coredns:v1.11.1<br \/>\ndocker tag registry.aliyuncs.com\/google_containers\/pause:3.9 registry.k8s.io\/pause:3.9<\/p>\n<p># \u53ef\u9009&#xff1a;\u5220\u9664\u963f\u91cc\u4e91\u6e90\u955c\u50cf&#xff0c;\u8282\u7701\u7a7a\u95f4&#xff08;\u53d6\u6d88\u6ce8\u91ca\u5373\u53ef\u542f\u7528&#xff09;<br \/>\n# echo -e &#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>\u5f00\u59cb\u6e05\u7406\u539f\u963f\u91cc\u4e91\u955c\u50cf&#8230;&#034;<br \/>\n# for image in &#034;\\\\<span class=\"token variable\">${images_list<span class=\"token punctuation\">[<\/span>&#064;<span class=\"token punctuation\">]<\/span>}<\/span>&#034;<br \/>\n# do<br \/>\n#     docker rmi &#034;\\\\<span class=\"token variable\">$image<\/span>&#034;<br \/>\n# done<\/p>\n<p>echo -e &#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>\u955c\u50cf\u62c9\u53d6\u53ca\u6807\u7b7e\u914d\u7f6e\u5b8c\u6210&#xff01;&#034;<br \/>\nEOF<\/span><\/p>\n<p><span class=\"token comment\"># \u6388\u6743\u5e76\u6267\u884c\u811a\u672c&#xff08;\u5355\u72ec\u6267\u884c\u4fbf\u4e8e\u6392\u67e5\u62a5\u9519&#xff09;<\/span><br \/>\n<span class=\"token function\">chmod<\/span> &#043;x images_download_k8s.sh<br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u6267\u884c\u955c\u50cf\u62c9\u53d6\u811a\u672c&#8230;&#034;<\/span><br \/>\n<span class=\"token function\">sh<\/span> images_download_k8s.sh<\/p>\n<p><span class=\"token comment\">#!\/bin\/bash<\/span><br \/>\n<span class=\"token comment\"># \u9a8c\u8bc1K8s\u6838\u5fc3\u955c\u50cf&#xff08;\u4fee\u590d\u53d8\u91cf\u5f15\u7528&#xff0c;\u786e\u4fdd\u8ba1\u6570\u51c6\u786e&#xff0c;\u9002\u914dbash&#xff09;<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> -e <span class=\"token string\">&#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u955c\u50cf\u9a8c\u8bc1\u7ed3\u679c &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u6b63\u786e\u83b7\u53d6\u955c\u50cf\u6570\u91cf&#xff0c;\u79fb\u9664\u591a\u4f59\u7684\u8f6c\u4e49\u7b26<\/span><br \/>\n<span class=\"token assign-left variable\">image_count<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">docker<\/span> images <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> registry.k8s.io <span class=\"token operator\">|<\/span> <span class=\"token function\">wc<\/span> -l<span class=\"token variable\">)<\/span><\/span><\/p>\n<p><span class=\"token comment\"># \u663e\u793a\u6240\u6709K8s\u6838\u5fc3\u955c\u50cf\u8be6\u60c5<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> -e <span class=\"token string\">&#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>\u3010\u5df2\u5b89\u88c5\u7684K8s\u6838\u5fc3\u955c\u50cf\u5217\u8868\u3011&#034;<\/span><br \/>\n<span class=\"token function\">docker<\/span> images <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> registry.k8s.io<\/p>\n<p><span class=\"token comment\"># \u6b63\u786e\u8f93\u51fa\u955c\u50cf\u6570\u91cf&#xff08;\u79fb\u9664\u53d8\u91cf\u524d\u7684\u8f6c\u4e49\u7b26&#xff09;<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> -e <span class=\"token string\">&#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>\u5171\u68c0\u6d4b\u5230 <span class=\"token variable\">$image_count<\/span> \u4e2aK8s\u6838\u5fc3\u955c\u50cf&#xff08;\u9700\u4e3a7\u4e2a&#xff09;&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u6574\u6570\u5224\u65ad&#xff0c;\u786e\u4fdd\u53d8\u91cf\u6b63\u786e\u89e3\u6790<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">[<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$image_count<\/span>&#034;<\/span> -eq <span class=\"token number\">7<\/span> <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> -e <span class=\"token string\">&#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>\u2705 \u955c\u50cf\u9a8c\u8bc1\u901a\u8fc7&#xff0c;\u53ef\u7ee7\u7eed\u6267\u884c\u96c6\u7fa4\u521d\u59cb\u5316&#xff01;&#034;<\/span><br \/>\n<span class=\"token keyword\">else<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> -e <span class=\"token string\">&#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>\u274c \u8b66\u544a&#xff1a;\u955c\u50cf\u6570\u91cf\u5f02\u5e38&#xff08;\u5b9e\u9645 <span class=\"token variable\">$image_count<\/span> \u4e2a&#xff09;&#xff0c;\u53ef\u80fd\u62c9\u53d6\u6216\u6807\u7b7e\u914d\u7f6e\u5931\u8d25&#xff01;&#034;<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u8bf7\u68c0\u67e5&#xff1a;1. \u7f51\u7edc\u662f\u5426\u80fd\u8bbf\u95ee\u963f\u91cc\u4e91\u955c\u50cf\u6e90 2. \u811a\u672c\u6267\u884c\u65e5\u5fd7\u662f\u5426\u6709\u62c9\u53d6\u62a5\u9519&#034;<\/span><br \/>\n<span class=\"token keyword\">fi<\/span><\/p>\n<p>\u91cd\u8981&#xff1a;\u6267\u884c\u5b8c\u6210\u540e\u5efa\u8bae\u7ed9Master\u8282\u70b9\u521b\u5efa\u5feb\u7167&#xff0c;\u907f\u514d\u90e8\u7f72\u5931\u8d25\u9700\u91cd\u65b0\u914d\u7f6e\u3002<\/p>\n<h3>5.2 \u96c6\u7fa4\u521d\u59cb\u5316&#xff08;master\u8282\u70b9&#xff09;<\/h3>\n<p>kubeadm init &#8211;kubernetes-version<span class=\"token operator\">&#061;<\/span>v1.29.0 <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;pod-network-cidr<span class=\"token operator\">&#061;<\/span><span class=\"token number\">10.244<\/span>.0.0\/16 <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;service-cidr<span class=\"token operator\">&#061;<\/span><span class=\"token number\">10.96<\/span>.0.0\/12 <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;apiserver-advertise-address<span class=\"token operator\">&#061;<\/span><span class=\"token number\">192.168<\/span>.56.100 <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;cri-socket<span class=\"token operator\">&#061;<\/span>unix:\/\/\/var\/run\/cri-dockerd.sock <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;image-repository<span class=\"token operator\">&#061;<\/span>registry.aliyuncs.com\/google_containers<\/p>\n<p>\u521d\u59cb\u5316\u6210\u529f\u540e&#xff0c;\u4f1a\u8f93\u51faWorker\u8282\u70b9\u52a0\u5165\u96c6\u7fa4\u7684\u547d\u4ee4&#xff0c;\u590d\u5236\u4fdd\u5b58&#xff08;\u540e\u7eedWorker\u8282\u70b9\u4f7f\u7528&#xff09;&#xff0c;\u683c\u5f0f\u5982\u4e0b&#xff08;\u5b9e\u9645token\u548chash\u4ee5\u81ea\u8eab\u8f93\u51fa\u4e3a\u51c6&#xff09;&#xff1a;<\/p>\n<p>kubeadm <span class=\"token function\">join<\/span> <span class=\"token number\">192.168<\/span>.56.100:6443 &#8211;token 5x76cq.zhm4xb91kgg8wwsx <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;discovery-token-ca-cert-hash sha256:4168af487686e7cd26f6f8034ac831beeca3f6ecfae550651d5ab6fd79acfe72 <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;cri-socket<span class=\"token operator\">&#061;<\/span>unix:\/\/\/var\/run\/cri-dockerd.sock<\/p>\n<h3>5.3 \u914d\u7f6ekubectl\u547d\u4ee4\u884c\u5de5\u5177<\/h3>\n<p><span class=\"token comment\"># \u521b\u5efakubectl\u914d\u7f6e\u76ee\u5f55<\/span><br \/>\n<span class=\"token function\">mkdir<\/span> -p <span class=\"token environment constant\">$HOME<\/span>\/.kube<br \/>\n<span class=\"token comment\"># \u590d\u5236\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">cp<\/span> -i \/etc\/kubernetes\/admin.conf <span class=\"token environment constant\">$HOME<\/span>\/.kube\/config<br \/>\n<span class=\"token comment\"># \u6388\u6743<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> <span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">id<\/span> -u<span class=\"token variable\">)<\/span><\/span><span class=\"token builtin class-name\">:<\/span><span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">id<\/span> -g<span class=\"token variable\">)<\/span><\/span> <span class=\"token environment constant\">$HOME<\/span>\/.kube\/config<br \/>\n<span class=\"token comment\"># \u751f\u6548\u73af\u5883\u53d8\u91cf&#xff08;root\u7528\u6237\u53ef\u6267\u884c&#xff09;<\/span><br \/>\n<span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">KUBECONFIG<\/span><span class=\"token operator\">&#061;<\/span>\/etc\/kubernetes\/admin.conf<br \/>\n<span class=\"token comment\"># \u9a8c\u8bc1kubectl&#xff08;\u8f93\u51fa\u96c6\u7fa4\u4fe1\u606f\u5373\u6210\u529f&#xff09;<\/span><br \/>\nkubectl cluster-info<\/p>\n<h3>5.4 \u90e8\u7f72Calico\u7f51\u7edc\u63d2\u4ef6<\/h3>\n<p>\u8bf4\u660e&#xff1a;\u4fee\u590d\u539f\u955c\u50cf\u6e90\u9002\u914d\u95ee\u9898&#xff0c;\u91c7\u7528Docker\u5b98\u65b9\u56fd\u5185\u955c\u50cf&#043;\u817e\u8baf\u4e91\u53cc\u6e90\u62c9\u53d6&#xff0c;\u65e0\u9700\u767b\u5f55&#xff0c;\u9002\u914d\u5b9e\u64cd\u573a\u666f\u3002\u6240\u6709\u8282\u70b9\u6267\u884c&#xff0c;Master\u5148\u6267\u884c\u3002<\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u65b9\u5f0f\u4e00&#xff1a;\u5728\u7ebf\u62c9\u53d6Calico\u5b98\u65b9\u955c\u50cf&#xff08;\u6240\u6709\u8282\u70b9\u90fd\u8981\u6267\u884c&#xff0c;Master\/Worker&#xff09; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token comment\"># Master\u8282\u70b9\u6267\u884c&#xff08;Worker\u8282\u70b9\u5355\u72ec\u590d\u5236\u8fd95\u884c\u6267\u884c&#xff09;<\/span><br \/>\n<span class=\"token function\">docker<\/span> pull docker.io\/calico\/cni:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> pull docker.io\/calico\/pod2daemon-flexvol:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> pull docker.io\/calico\/node:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> pull docker.io\/calico\/kube-controllers:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> pull docker.io\/calico\/typha:v3.24.1<\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u65b9\u5f0f\u4e8c&#xff1a;tar\u5305\u5bfc\u5165\u955c\u50cf&#xff08;\u79bb\u7ebf\u73af\u5883\u4f7f\u7528&#xff0c;\u6240\u6709\u8282\u70b9\u90fd\u8981\u6267\u884c&#xff0c;Master\/Worker&#xff09; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token comment\"># \u8bf4\u660e&#xff1a;\u9700\u63d0\u524d\u5c06\u5bf9\u5e94tar\u5305\u4e0a\u4f20\u81f3\u8282\u70b9\u4efb\u610f\u76ee\u5f55&#xff08;\u5982\/root\u76ee\u5f55&#xff09;&#xff0c;\u8fdb\u5165tar\u5305\u6240\u5728\u76ee\u5f55\u540e\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4<\/span><br \/>\n<span class=\"token comment\"># \u52a0\u8f7d calico\/cni \u955c\u50cf<\/span><br \/>\n<span class=\"token function\">docker<\/span> load -i calico_cni_v3.24.1.tar<br \/>\n<span class=\"token comment\"># \u52a0\u8f7d calico\/kube-controllers \u955c\u50cf<\/span><br \/>\n<span class=\"token function\">docker<\/span> load -i calico_kube-controllers_v3.24.1.tar<br \/>\n<span class=\"token comment\"># \u52a0\u8f7d calico\/node \u955c\u50cf<\/span><br \/>\n<span class=\"token function\">docker<\/span> load -i calico_node_v3.24.1.tar<br \/>\n<span class=\"token comment\"># \u52a0\u8f7d calico\/pod2daemon-flexvol \u955c\u50cf<\/span><br \/>\n<span class=\"token function\">docker<\/span> load -i calico_pod2daemon-flexvol_v3.24.1.tar<br \/>\n<span class=\"token comment\"># \u52a0\u8f7d calico\/typha \u955c\u50cf<\/span><br \/>\n<span class=\"token function\">docker<\/span> load -i calico_typha_v3.24.1.tar<\/p>\n<p><span class=\"token comment\"># \u4e3a\u955c\u50cf\u6253\u6807\u7b7e&#xff08;\u9002\u914dCalico\u914d\u7f6e\u6587\u4ef6\u9ed8\u8ba4\u955c\u50cf\u540d\u79f0&#xff0c;\u786e\u4fdd\u90e8\u7f72\u6b63\u5e38&#xff09;<\/span><br \/>\n<span class=\"token function\">docker<\/span> tag docker.io\/calico\/cni:v3.24.1 calico\/cni:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> tag docker.io\/calico\/pod2daemon-flexvol:v3.24.1 calico\/pod2daemon-flexvol:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> tag docker.io\/calico\/node:v3.24.1 calico\/node:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> tag docker.io\/calico\/kube-controllers:v3.24.1 calico\/kube-controllers:v3.24.1<br \/>\n<span class=\"token function\">docker<\/span> tag docker.io\/calico\/typha:v3.24.1 calico\/typha:v3.24.1<\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u90e8\u7f72Calico\u914d\u7f6e&#xff08;\u4e24\u79cd\u955c\u50cf\u83b7\u53d6\u65b9\u5f0f\u5171\u7528&#xff0c;\u4ec5Master\u8282\u70b9\u6267\u884c&#xff09; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token comment\"># \u4e0b\u8f7d\u5b98\u65b9\u914d\u7f6e\u6587\u4ef6\u5e76\u4fee\u6539Pod\u7f51\u6bb5&#xff08;\u4e0ek8s\u521d\u59cb\u5316\u7f51\u6bb5\u4e00\u81f4&#xff09;<\/span><br \/>\n<span class=\"token function\">wget<\/span> https:\/\/raw.githubusercontent.com\/projectcalico\/calico\/v3.24.1\/manifests\/calico.yaml -O \/root\/calico.yaml<br \/>\n<span class=\"token function\">sed<\/span> -i <span class=\"token string\">&#039;s\/192.168.0.0\\\\\/16\/10.244.0.0\\\\\/16\/g&#039;<\/span> \/root\/calico.yaml<\/p>\n<p><span class=\"token comment\"># \u90e8\u7f72Calico<\/span><br \/>\nkubectl apply -f \/root\/calico.yaml<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u90e8\u7f72\u540e\u7684\u72b6\u6001<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> -e <span class=\"token string\">&#034;<span class=\"token entity\" title=\"\\\\n\">\\\\n<\/span>Calico Pod\u72b6\u6001&#xff08;\u6240\u6709Pod\u4e3aRunning\u5373\u6b63\u5e38&#xff09;&#xff1a;&#034;<\/span><br \/>\nkubectl get pods -n kube-system <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> calico<\/p>\n<h2>\u516d\u3001Worker\u8282\u70b9\u52a0\u5165\u96c6\u7fa4<\/h2>\n<li>\n<p>\u786e\u4fddWorker\u8282\u70b9\u5df2\u5b8c\u6210\u524d\u9762\u201c\u6240\u6709\u8282\u70b9\u201d\u7684\u6240\u6709\u914d\u7f6e&#xff08;\u57fa\u7840\u914d\u7f6e\u3001Docker\u3001cri-dockerd\u3001K8s\u7ec4\u4ef6\u3001\u955c\u50cf\u62c9\u53d6&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6267\u884cMaster\u8282\u70b9\u521d\u59cb\u5316\u6210\u529f\u540e\u4fdd\u5b58\u7684join\u547d\u4ee4&#xff08;\u82e5\u547d\u4ee4\u4e22\u5931&#xff0c;\u5728Master\u8282\u70b9\u91cd\u65b0\u751f\u6210&#xff09;&#xff1a;<\/p>\n<\/li>\n<p><span class=\"token comment\"># Master\u8282\u70b9\u91cd\u65b0\u751f\u6210join\u547d\u4ee4&#xff08;\u6709\u6548\u671f\u6c38\u4e45&#xff09;<\/span><br \/>\nkubeadm token create &#8211;ttl <span class=\"token number\">0<\/span> &#8211;print-join-command<\/p>\n<p><span class=\"token comment\"># Worker\u8282\u70b9\u6267\u884cjoin\u547d\u4ee4&#xff08;\u66ff\u6362\u4e3a\u5b9e\u9645\u751f\u6210\u7684\u547d\u4ee4&#xff0c;\u6dfb\u52a0cri-socket\u53c2\u6570&#xff09;<\/span><br \/>\nkubeadm <span class=\"token function\">join<\/span> <span class=\"token number\">192.168<\/span>.56.100:6443 &#8211;token xxxx.xxxx <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;discovery-token-ca-cert-hash sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <span class=\"token punctuation\">\\\\<\/span><br \/>\n&#8211;cri-socket<span class=\"token operator\">&#061;<\/span>unix:\/\/\/var\/run\/cri-dockerd.sock<\/p>\n<li>Master\u8282\u70b9\u9a8c\u8bc1\u8282\u70b9\u52a0\u5165&#xff1a;<\/li>\n<p><span class=\"token comment\"># \u67e5\u770b\u8282\u70b9\u72b6\u6001&#xff08;\u6240\u6709\u8282\u70b9\u4e3aReady\u5373\u6210\u529f&#xff0c;NotReady\u9700\u7b49\u5f85Calico\u90e8\u7f72\u5b8c\u6210&#xff09;<\/span><br \/>\nkubectl get nodes<br \/>\n<span class=\"token comment\"># \u5b9e\u9645\u6210\u529f\u8f93\u51fa\u793a\u4f8b&#xff08;\u4e0e\u5b9e\u64cd\u7ed3\u679c\u4e00\u81f4&#xff09;&#xff1a;<\/span><br \/>\n<span class=\"token comment\"># NAME            STATUS   ROLES           AGE   VERSION<\/span><br \/>\n<span class=\"token comment\"># k8s-master      Ready    control-plane   57m   v1.29.15<\/span><br \/>\n<span class=\"token comment\"># k8s-worker-01   Ready    &lt;none&gt;          54m   v1.29.15<\/span><\/p>\n<p><span class=\"token comment\"># \u7ed9Worker\u8282\u70b9\u6253\u6807\u7b7e&#xff08;\u53ef\u9009&#xff0c;\u4fbf\u4e8e\u7ba1\u7406&#xff0c;\u6807\u7b7e\u540e\u663e\u793aworker\u89d2\u8272&#xff09;<\/span><br \/>\nkubectl label <span class=\"token function\">node<\/span> k8s-worker-01 node-role.kubernetes.io\/worker<span class=\"token operator\">&#061;<\/span>worker<br \/>\nkubectl label <span class=\"token function\">node<\/span> k8s-worker-02 node-role.kubernetes.io\/worker<span class=\"token operator\">&#061;<\/span>worker<br \/>\n<span class=\"token comment\"># \u6807\u7b7e\u540e\u9a8c\u8bc1&#xff08;Worker\u8282\u70b9\u89d2\u8272\u751f\u6548&#xff09;<\/span><br \/>\nkubectl get nodes<br \/>\n<span class=\"token comment\"># \u6807\u7b7e\u540e\u8f93\u51fa\u793a\u4f8b&#xff1a;<\/span><br \/>\n<span class=\"token comment\"># NAME            STATUS   ROLES           AGE   VERSION<\/span><br \/>\n<span class=\"token comment\"># k8s-master      Ready    control-plane   58m   v1.29.15<\/span><br \/>\n<span class=\"token comment\"># k8s-worker-01   Ready    worker          55m   v1.29.15<\/span><\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u8282\u70b9\u8be6\u7ec6\u4fe1\u606f&#xff0c;\u786e\u8ba4\u65e0\u5f02\u5e38\u4e8b\u4ef6<\/span><br \/>\nkubectl describe <span class=\"token function\">node<\/span> k8s-worker-01 <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> -A <span class=\"token number\">10<\/span> <span class=\"token string\">&#034;Conditions&#034;<\/span><br \/>\n<span class=\"token comment\"># \u82e5\u5b58\u5728\u5176\u4ed6Worker\u8282\u70b9&#xff08;\u5982k8s-worker-02&#xff09;&#xff0c;\u91cd\u590d\u6267\u884cjoin\u547d\u4ee4\u548c\u6807\u7b7e\u64cd\u4f5c\u5373\u53ef<\/span><\/p>\n<p>\u8bf4\u660e&#xff1a;\u82e5\u6267\u884cjoin\u547d\u4ee4\u540e\u8f93\u51fa\u7c7b\u4f3c\u4ee5\u4e0b\u5185\u5bb9&#xff0c;\u5373\u8868\u793a\u8282\u70b9\u52a0\u5165\u6210\u529f&#xff1a;<\/p>\n<p><span class=\"token punctuation\">[<\/span>preflight<span class=\"token punctuation\">]<\/span> Running pre-flight checks<br \/>\n<span class=\"token punctuation\">[<\/span>preflight<span class=\"token punctuation\">]<\/span> Reading configuration from the cluster<span class=\"token punctuation\">..<\/span>.<br \/>\n<span class=\"token punctuation\">[<\/span>preflight<span class=\"token punctuation\">]<\/span> FYI: You can <span class=\"token function\">look<\/span> at this config <span class=\"token function\">file<\/span> with <span class=\"token string\">&#039;kubectl -n kube-system get cm kubeadm-config -o yaml&#039;<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>kubelet-start<span class=\"token punctuation\">]<\/span> Writing kubelet configuration to <span class=\"token function\">file<\/span> <span class=\"token string\">&#034;\/var\/lib\/kubelet\/config.yaml&#034;<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>kubelet-start<span class=\"token punctuation\">]<\/span> Writing kubelet environment <span class=\"token function\">file<\/span> with flags to <span class=\"token function\">file<\/span> <span class=\"token string\">&#034;\/var\/lib\/kubelet\/kubeadm-flags.env&#034;<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>kubelet-start<span class=\"token punctuation\">]<\/span> Starting the kubelet<br \/>\n<span class=\"token punctuation\">[<\/span>kubelet-start<span class=\"token punctuation\">]<\/span> Waiting <span class=\"token keyword\">for<\/span> the kubelet to perform the TLS Bootstrap<span class=\"token punctuation\">..<\/span>.<\/p>\n<p>This <span class=\"token function\">node<\/span> has joined the cluster:<br \/>\n* Certificate signing request was sent to apiserver and a response was received.<br \/>\n* The Kubelet was informed of the new secure connection details.<\/p>\n<p>Run <span class=\"token string\">&#039;kubectl get nodes&#039;<\/span> on the control-plane to see this <span class=\"token function\">node<\/span> <span class=\"token function\">join<\/span> the cluster.<\/p>\n<p>\u5b9e\u64cd\u9a8c\u8bc1\u7ed3\u679c&#xff1a;\u6267\u884cjoin\u547d\u4ee4\u540e&#xff0c;\u5728Master\u8282\u70b9\u6267\u884ckubectl get nodes&#xff0c;\u5df2\u6210\u529f\u8bc6\u522bk8s-worker-01\u8282\u70b9&#xff0c;\u4e14\u4e24\u8005\u5747\u5904\u4e8eReady\u72b6\u6001&#xff0c;\u8bf4\u660e&#xff1a;1. \u8282\u70b9\u52a0\u5165\u96c6\u7fa4\u6210\u529f&#xff1b;2. Calico\u7f51\u7edc\u63d2\u4ef6\u90e8\u7f72\u751f\u6548&#xff0c;\u8282\u70b9\u7f51\u7edc\u8fde\u901a\u6b63\u5e38&#xff1b;3. \u96c6\u7fa4\u57fa\u7840\u7ec4\u4ef6\u8fd0\u884c\u7a33\u5b9a&#xff0c;\u53ef\u8fdb\u5165\u540e\u7eed\u53ef\u7528\u6027\u9a8c\u8bc1\u73af\u8282\u3002<\/p>\n<p>\u6210\u529f\u540e\u53ea\u9700\u5728Master\u8282\u70b9\u6267\u884ckubectl get nodes\u786e\u8ba4\u8282\u70b9\u72b6\u6001&#xff0c;\u5f85\u6240\u6709\u8282\u70b9\u53d8\u4e3aReady\u540e&#xff0c;\u5373\u53ef\u8fdb\u884c\u96c6\u7fa4\u53ef\u7528\u6027\u9a8c\u8bc1\u3002<\/p>\n<p><span class=\"token comment\"># \u67e5\u770b\u8282\u70b9\u72b6\u6001&#xff08;\u6240\u6709\u8282\u70b9\u4e3aReady\u5373\u6210\u529f&#xff0c;NotReady\u9700\u7b49\u5f85Calico\u90e8\u7f72\u5b8c\u6210&#xff09;<\/span><br \/>\nkubectl get nodes<br \/>\n<span class=\"token comment\"># \u7ed9Worker\u8282\u70b9\u6253\u6807\u7b7e&#xff08;\u53ef\u9009&#xff0c;\u4fbf\u4e8e\u7ba1\u7406&#xff09;<\/span><br \/>\nkubectl label <span class=\"token function\">node<\/span> k8s-worker-01 node-role.kubernetes.io\/worker<span class=\"token operator\">&#061;<\/span>worker<br \/>\nkubectl label <span class=\"token function\">node<\/span> k8s-worker-02 node-role.kubernetes.io\/worker<span class=\"token operator\">&#061;<\/span>worker<br \/>\n<span class=\"token comment\"># \u518d\u6b21\u67e5\u770b&#xff08;Worker\u8282\u70b9\u663e\u793aworker\u89d2\u8272&#xff09;<\/span><br \/>\nkubectl get nodes -o wide<\/p>\n<h2>\u4e03\u3001\u96c6\u7fa4\u53ef\u7528\u6027\u9a8c\u8bc1<\/h2>\n<h3>7.1 \u57fa\u7840\u72b6\u6001\u9a8c\u8bc1<\/h3>\n<p><span class=\"token comment\"># 1. \u67e5\u770b\u96c6\u7fa4\u7ec4\u4ef6\u5065\u5eb7\u72b6\u6001<\/span><br \/>\nkubectl get cs<br \/>\n<span class=\"token comment\"># \u63d0\u793a&#xff1a;v1 ComponentStatus\u5df2\u5e9f\u5f03&#xff0c;\u53ef\u5ffd\u7565\u8b66\u544a&#xff0c;\u72b6\u6001\u4e3aHealthy\u5373\u6b63\u5e38<\/span><\/p>\n<p><span class=\"token comment\"># 2. \u67e5\u770b\u7cfb\u7edfPod\u72b6\u6001&#xff08;\u6240\u6709Pod\u5747\u4e3aRunning&#xff09;<\/span><br \/>\nkubectl get pods -n kube-system -o wide<\/p>\n<h3>7.2 \u90e8\u7f72Nginx\u6d4b\u8bd5Pod\u7f51\u7edc<\/h3>\n<p><span class=\"token comment\"># 1.\u62c9\u53d6\u955c\u50cf&#xff08;\u9632\u6b62\u76f4\u63a5\u90e8\u7f72\u7684\u65f6\u5019\u62c9\u53d6\u955c\u50cf\u5931\u8d25\u5bfc\u81f4\u90e8\u7f72\u5931\u8d25&#xff09;<\/span><br \/>\n<span class=\"token function\">docker<\/span> pull nginx<br \/>\n<span class=\"token comment\"># 2. \u521b\u5efaNginx Deployment&#xff08;2\u4e2a\u526f\u672c&#xff09;<\/span><br \/>\nkubectl create deployment nginx &#8211;image<span class=\"token operator\">&#061;<\/span>nginx:1.24 &#8211;replicas<span class=\"token operator\">&#061;<\/span><span class=\"token number\">2<\/span><br \/>\n<span class=\"token comment\"># 3. \u66b4\u9732\u4e3aNodePort\u670d\u52a1&#xff08;\u5916\u90e8\u53ef\u8bbf\u95ee&#xff09;<\/span><br \/>\nkubectl expose deployment nginx &#8211;port<span class=\"token operator\">&#061;<\/span><span class=\"token number\">80<\/span> &#8211;type<span class=\"token operator\">&#061;<\/span>NodePort<br \/>\n<span class=\"token comment\"># 4. \u67e5\u770bDeployment\u548cService\u72b6\u6001<\/span><br \/>\nkubectl get deployments,svc<br \/>\n<span class=\"token comment\"># \u8f93\u51fa\u793a\u4f8b&#xff1a;service\/nginx   NodePort    10.106.52.54   &lt;none&gt;        80:31423\/TCP   30s<\/span><br \/>\n<span class=\"token comment\"># \u5176\u4e2d31423\u4e3aNodePort\u7aef\u53e3&#xff08;\u968f\u673a\u751f\u6210&#xff0c;\u8bb0\u5f55\u81ea\u8eab\u7aef\u53e3&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># 5. \u6d4b\u8bd5\u8bbf\u95ee&#xff08;\u4efb\u610f\u8282\u70b9IP&#043;NodePort&#xff09;<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token number\">192.168<\/span>.56.100:31423  <span class=\"token comment\"># Master\u8282\u70b9IP&#043;\u7aef\u53e3<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token number\">192.168<\/span>.56.101:31423  <span class=\"token comment\"># Worker01\u8282\u70b9IP&#043;\u7aef\u53e3<\/span><br \/>\n<span class=\"token comment\"># \u8f93\u51faNginx\u6b22\u8fce\u9875\u5373\u6210\u529f&#xff0c;\u8bf4\u660ePod\u7f51\u7edc\u3001Service\u5747\u6b63\u5e38<\/span><\/p>\n<p><span class=\"token comment\"># 5. \u6e05\u7406\u6d4b\u8bd5\u8d44\u6e90&#xff08;\u53ef\u9009&#xff09;<\/span><br \/>\nkubectl delete deployment nginx<br \/>\nkubectl delete svc nginx<\/p>\n<h2>\u516b\u3001\u96c6\u7fa4\u91cd\u7f6e&#xff08;\u90e8\u7f72\u5931\u8d25\u65f6&#xff09;<\/h2>\n<p><span class=\"token comment\"># \u6240\u6709\u8282\u70b9\u6267\u884c\u91cd\u7f6e<\/span><br \/>\nkubeadm reset -f<br \/>\n<span class=\"token comment\"># \u5220\u9664\u7f51\u7edc\u914d\u7f6e\u548ckubectl\u914d\u7f6e<\/span><br \/>\n<span class=\"token function\">rm<\/span> -rf \/etc\/cni\/net.d<br \/>\n<span class=\"token function\">rm<\/span> -rf <span class=\"token environment constant\">$HOME<\/span>\/.kube<br \/>\n<span class=\"token comment\"># \u91cd\u542fkubelet\u548ccri-docker<\/span><br \/>\nsystemctl restart kubelet cri-docker<br \/>\n<span class=\"token comment\"># Master\u8282\u70b9\u91cd\u65b0\u521d\u59cb\u5316\u5373\u53ef<\/span><\/p>\n<h2>\u4e5d\u3001\u6ce8\u610f\u4e8b\u9879<\/h2>\n<li>\n<p>\u6240\u6709\u8282\u70b9\u7f51\u7edc\u5fc5\u987b\u4e92\u901a&#xff0c;\u786e\u4fdd192.168.56.0\/24\u7f51\u6bb5\u5185\u8282\u70b9\u53ef\u6b63\u5e38\u901a\u4fe1&#xff08;\u5df2\u5173\u95ed\u9632\u706b\u5899&#xff0c;\u65e0\u9700\u989d\u5916\u914d\u7f6e&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u955c\u50cf\u62c9\u53d6\u82e5\u5931\u8d25&#xff0c;\u68c0\u67e5\u7f51\u7edc\u662f\u5426\u80fd\u8bbf\u95ee\u963f\u91cc\u4e91\u3001Docker\u5b98\u65b9\u3001\u817e\u8baf\u4e91\u955c\u50cf\u6e90&#xff0c;\u672c\u6587\u811a\u672c\u5df2\u91c7\u7528\u591a\u6e90\u4fdd\u969c&#xff0c;\u53ef\u76f4\u63a5\u590d\u7528\u3002<\/p>\n<\/li>\n<li>\n<p>\u96c6\u7fa4\u90e8\u7f72\u5b8c\u6210\u540e&#xff0c;\u5efa\u8bae\u5907\u4efdMaster\u8282\u70b9\u7684\/etc\/kubernetes\u76ee\u5f55\u548c$HOME\/.kube\/config\u6587\u4ef6&#xff0c;\u7528\u4e8e\u96c6\u7fa4\u6062\u590d\u3002<\/p>\n<\/li>\n<li>\n<p>CentOS 7.9\u7cfb\u7edf\u9700\u786e\u4fdd\u5df2\u5b89\u88c5\u6240\u6709\u8865\u4e01&#xff08;yum update -y&#xff09;&#xff0c;\u907f\u514d\u5185\u6838\u6f0f\u6d1e\u5bfc\u81f4\u7684\u95ee\u9898\u3002<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4&#xff08;CentOS 7.9\u6700\u7ec8\u7248&#xff09;<br \/>\n\u4e00\u3001\u73af\u5883\u51c6\u5907<br \/>\n1.1 \u64cd\u4f5c\u7cfb\u7edf\u8981\u6c42<br \/>\n\u64cd\u4f5c\u7cfb\u7edf&#xff1a;CentOS 7.9&#xff08;\u6700\u5c0f\u5316\u5b89\u88c5&#xff0c;\u5df2\u914d\u7f6e\u57fa\u7840\u7f51\u7edc&#xff09;<br \/>\n\u5185\u6838\u8981\u6c42&#xff1a;3.10.0-1160.el7.x86_64\u53ca\u4ee5\u4e0a&#xff08;\u6267\u884cuname -r\u9a8c\u8bc1&#xff0c;\u4f4e\u4e8e\u6b64\u7248\u672c\u9700\u5347\u7ea7\u5185\u6838&#xff09;<br \/>\n1.2 \u96c6\u7fa4\u89c4\u5212\u4e3b\u673a\u540dIP\u5730\u5740\u5185\u5b58\u786c\u76d8\u89d2\u8272<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[59,120,121],"topic":[],"class_list":["post-65483","post","type-post","status-publish","format-standard","hentry","category-server","tag-centos","tag-kubernetes","tag-121"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/65483.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4&#xff08;CentOS 7.9\u6700\u7ec8\u7248&#xff09; \u4e00\u3001\u73af\u5883\u51c6\u5907 1.1 \u64cd\u4f5c\u7cfb\u7edf\u8981\u6c42 \u64cd\u4f5c\u7cfb\u7edf&#xff1a;CentOS 7.9&#xff08;\u6700\u5c0f\u5316\u5b89\u88c5&#xff0c;\u5df2\u914d\u7f6e\u57fa\u7840\u7f51\u7edc&#xff09; \u5185\u6838\u8981\u6c42&#xff1a;3.10.0-1160.el7.x86_64\u53ca\u4ee5\u4e0a&#xff08;\u6267\u884cuname -r\u9a8c\u8bc1&#xff0c;\u4f4e\u4e8e\u6b64\u7248\u672c\u9700\u5347\u7ea7\u5185\u6838&#xff09; 1.2 \u96c6\u7fa4\u89c4\u5212\u4e3b\u673a\u540dIP\u5730\u5740\u5185\u5b58\u786c\u76d8\u89d2\u8272\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/65483.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-24T18:16:34+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65483.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/65483.html\",\"name\":\"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-24T18:16:34+00:00\",\"dateModified\":\"2026-01-24T18:16:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/65483.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/65483.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65483.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/65483.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4&#xff08;CentOS 7.9\u6700\u7ec8\u7248&#xff09; \u4e00\u3001\u73af\u5883\u51c6\u5907 1.1 \u64cd\u4f5c\u7cfb\u7edf\u8981\u6c42 \u64cd\u4f5c\u7cfb\u7edf&#xff1a;CentOS 7.9&#xff08;\u6700\u5c0f\u5316\u5b89\u88c5&#xff0c;\u5df2\u914d\u7f6e\u57fa\u7840\u7f51\u7edc&#xff09; \u5185\u6838\u8981\u6c42&#xff1a;3.10.0-1160.el7.x86_64\u53ca\u4ee5\u4e0a&#xff08;\u6267\u884cuname -r\u9a8c\u8bc1&#xff0c;\u4f4e\u4e8e\u6b64\u7248\u672c\u9700\u5347\u7ea7\u5185\u6838&#xff09; 1.2 \u96c6\u7fa4\u89c4\u5212\u4e3b\u673a\u540dIP\u5730\u5740\u5185\u5b58\u786c\u76d8\u89d2\u8272","og_url":"https:\/\/www.wsisp.com\/helps\/65483.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-24T18:16:34+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/65483.html","url":"https:\/\/www.wsisp.com\/helps\/65483.html","name":"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-24T18:16:34+00:00","dateModified":"2026-01-24T18:16:34+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/65483.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/65483.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/65483.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8ekubeadm\u90e8\u7f72Kubernetes 1.29\u96c6\u7fa4\uff08CentOS 7.9\u6700\u7ec8\u7248\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/65483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=65483"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/65483\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=65483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=65483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=65483"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=65483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}