{"id":107774,"date":"2026-09-20T10:16:36","date_gmt":"2026-09-20T02:16:36","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/107774.html"},"modified":"2026-09-20T10:16:36","modified_gmt":"2026-09-20T02:16:36","slug":"rocky-linux-9-%e9%ab%98%e5%8f%af%e7%94%a8-kubernetes-%e9%9b%86%e7%be%a4%e9%83%a8%e7%bd%b2%e6%89%8b%e5%86%8c","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/107774.html","title":{"rendered":"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c"},"content":{"rendered":"<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6807\u51c6\u751f\u4ea7\u67b6\u6784&#xff1a;3 Master &#043; 3 Worker &#043; 2 LB &#043; Harbor<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u57fa\u4e8e VMware Workstation \u514b\u9686\u673a<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#333333\">Kubernetes v1.36 \u00a0\u00b7 \u00a0containerd \u00a0\u00b7 \u00a0Calico \u00a0\u00b7 \u00a0Keepalived &#043; HAProxy \u00a0\u00b7 \u00a0Harbor<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#333333\">Tommypeng<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#333333\">2026-09-12<\/span><\/span><\/p>\n<\/p>\n<h2 style=\"text-align:center\"><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u76ee \u00a0\u5f55<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u4e00\u7ae0 \u00a0\u67b6\u6784\u8bbe\u8ba1\u4e0e\u89c4\u5212<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">1.1 \u603b\u4f53\u67b6\u6784<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">1.2 \u8282\u70b9\u6e05\u5355\u4e0e IP \u89c4\u5212<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">1.3 \u7248\u672c\u9009\u578b<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">1.4 \u8d44\u6e90\u5206\u914d\u5efa\u8bae<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">1.5 \u7aef\u53e3\u6e05\u5355&#xff08;\u8fd0\u7ef4\u653e\u884c\u53c2\u8003&#xff09;<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u4e8c\u7ae0 \u00a0\u57fa\u4e8e\u6807\u51c6\u673a\u514b\u9686\u51fa 9 \u53f0\u865a\u62df\u673a<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">2.0 \u6267\u884c\u73af\u5883\u8bf4\u660e&#xff08;\u91cd\u8981&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">2.1 \u6807\u51c6\u673a\u57fa\u7840\u914d\u7f6e<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">2.2 VMware Workstation \u514b\u9686\u6b65\u9aa4<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">2.3 \u9010\u53f0\u8bbe\u7f6e\u4e3b\u673a\u540d<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">2.4 \u9010\u53f0\u4fee\u6539\u9759\u6001 IP<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u4e09\u7ae0 \u00a0\u90e8\u7f72\u8d1f\u8f7d\u5747\u8861\u5c42&#xff08;Keepalived &#043; HAProxy&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">3.1 \u5b89\u88c5 Keepalived \u4e0e HAProxy<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">3.2 LB \u8282\u70b9\u5185\u6838\u53c2\u6570&#xff08;\u751f\u4ea7\u589e\u5f3a&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">3.3 \u914d\u7f6e HAProxy&#xff08;lb01 \u4e0e lb02 \u76f8\u540c&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">3.4 \u914d\u7f6e Keepalived&#xff08;lb01 \u4e3b\u3001lb02 \u5907&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">3.5 \u9a8c\u8bc1\u8d1f\u8f7d\u5747\u8861\u5c42<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u56db\u7ae0 \u00a0\u90e8\u7f72\u5bb9\u5668\u8fd0\u884c\u65f6\u4e0e Kubernetes \u7ec4\u4ef6<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">4.1 \u52a0\u8f7d\u5185\u6838\u6a21\u5757&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">4.2 \u914d\u7f6e\u5185\u6838\u53c2\u6570&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">4.3 \u5173\u95ed swap&#xff08;Rocky 9 \u9ed8\u8ba4\u7cfb\u7edf\u65e0 swap&#xff0c;\u5982\u6709\u5219\u5173\u95ed&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">4.4 \u5b89\u88c5 containerd&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">4.5 \u914d\u7f6e K8s \u8f6f\u4ef6\u6e90&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">4.6 \u5b89\u88c5 kubeadm \/ kubelet \/ kubectl&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">4.7 \u9a8c\u8bc1\u57fa\u7840\u73af\u5883<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u4e94\u7ae0 \u00a0\u521d\u59cb\u5316\u9ad8\u53ef\u7528\u63a7\u5236\u9762&#xff08;Master&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">5.1 \u751f\u6210\u5e76\u4fee\u6539\u521d\u59cb\u5316\u914d\u7f6e&#xff08;k8s-m1 \u6267\u884c&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">5.2 \u6821\u9a8c\u914d\u7f6e\u8bed\u6cd5&#xff08;\u5f3a\u70c8\u5efa\u8bae&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">5.3 \u9884\u62c9\u53d6\u955c\u50cf&#xff08;\u53ef\u9009&#xff0c;\u52a0\u901f\u521d\u59cb\u5316&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">5.4 \u521d\u59cb\u5316\u7b2c\u4e00\u4e2a\u63a7\u5236\u9762\u8282\u70b9&#xff08;k8s-m1&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">5.5 \u914d\u7f6e kubectl&#xff08;k8s-m1&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">5.6 \u52a0\u5165\u5176\u4f59 Master&#xff08;k8s-m2 \/ k8s-m3&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">5.7 \u6709\u6548\u671f\u63d0\u9192\u4e0e\u8865\u6551<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u516d\u7ae0 \u00a0\u90e8\u7f72 Calico \u7f51\u7edc\u63d2\u4ef6<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">6.1 \u83b7\u53d6\u5e76\u4fee\u6539 Calico \u6e05\u5355<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">6.2 \u5e94\u7528 Calico<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">6.3 \u786e\u8ba4\u8282\u70b9\u5c31\u7eea<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u4e03\u7ae0 \u00a0\u52a0\u5165 Worker \u8282\u70b9<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">7.1 \u91cd\u65b0\u751f\u6210 token&#xff08;\u82e5\u5df2\u8fc7\u671f&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">7.2 \u9a8c\u8bc1\u96c6\u7fa4\u8282\u70b9<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u516b\u7ae0 \u00a0\u9a8c\u8bc1\u9ad8\u53ef\u7528\u4e0e\u6545\u969c\u6f14\u7ec3<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">8.1 \u901a\u8fc7 VIP \u8bbf\u95ee API Server<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">8.2 \u6d4b\u8bd5 API Server \u8d1f\u8f7d\u5747\u8861<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">8.3 \u6f14\u7ec3&#xff1a;Master \u6545\u969c\u8f6c\u79fb<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">8.4 \u6f14\u7ec3&#xff1a;LB \u6545\u969c\u8f6c\u79fb<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">8.5 \u90e8\u7f72\u6d4b\u8bd5\u5e94\u7528<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u4e5d\u7ae0 \u00a0\u96c6\u7fa4\u90e8\u7f72\u540e\u5de1\u68c0\u6e05\u5355<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">9.1 \u96c6\u7fa4\u6574\u4f53\u72b6\u6001<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">9.2 etcd \u5065\u5eb7\u68c0\u67e5&#xff08;\u751f\u4ea7\u5173\u952e&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">9.3 etcd \u5b9a\u671f\u5907\u4efd&#xff08;\u751f\u4ea7\u5fc5\u5907&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">9.4 \u63a7\u5236\u9762\u7ec4\u4ef6\u72b6\u6001<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">9.5 \u7f51\u7edc\u63d2\u4ef6\u4e0e CoreDNS<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">9.6 \u8d44\u6e90\u4e0e\u8282\u70b9\u5065\u5eb7<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b2c\u5341\u7ae0 \u00a0\u90e8\u7f72 Harbor \u79c1\u6709\u955c\u50cf\u4ed3\u5e93<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.1 \u67b6\u6784\u6f84\u6e05&#xff1a;Harbor \u4e0e\u96c6\u7fa4\u8ba4\u8bc1\u7684\u5173\u7cfb<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.2 \u5b89\u88c5 Docker&#xff08;harbor \u8282\u70b9&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.3 \u51c6\u5907\u81ea\u7b7e HTTPS \u8bc1\u4e66<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.4 \u4e0b\u8f7d\u5e76\u914d\u7f6e Harbor<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.5 \u6267\u884c\u5b89\u88c5<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.6 \u65f6\u95f4\u540c\u6b65\u6821\u9a8c&#xff08;\u8bc1\u4e66\u4f9d\u8d56&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.7 \u96c6\u7fa4\u8282\u70b9\u4fe1\u4efb Harbor CA&#xff08;6 \u53f0\u8282\u70b9\u5168\u90e8\u914d\u7f6e&#xff09;<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.8 \u521b\u5efa regcred \u62c9\u53d6\u51ed\u8bc1<\/span><\/span><\/p>\n<p style=\"margin-left:21pt\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.9 \u9a8c\u8bc1\u4ece Harbor \u62c9\u53d6\u955c\u50cf<\/span><\/span><\/p>\n<p><span style=\"color:#333333\"><span style=\"color:#333333\">\u7ed3\u8bed<\/span><\/span><\/p>\n<\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u4e00\u7ae0 \u00a0\u67b6\u6784\u8bbe\u8ba1\u4e0e\u89c4\u5212<\/span><\/span><\/h2>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">1.1 \u603b\u4f53\u67b6\u6784<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u672c\u65b9\u6848\u91c7\u7528\u6807\u51c6\u751f\u4ea7\u9ad8\u53ef\u7528\u67b6\u6784&#xff1a;3 \u53f0\u63a7\u5236\u9762\u8282\u70b9&#xff08;Master&#xff09;\u5185\u7f6e etcd \u7ec4\u6210\u4e09\u526f\u672c&#xff0c;\u524d\u7aef\u7531 2 \u53f0 Keepalived &#043; HAProxy \u8d1f\u8f7d\u5747\u8861\u8282\u70b9\u63d0\u4f9b\u865a\u62df IP&#xff08;VIP&#xff09;&#xff0c;3 \u53f0\u5de5\u4f5c\u8282\u70b9&#xff08;Worker&#xff09;\u627f\u8f7d\u4e1a\u52a1 Pod\u3002\u4efb\u4f55\u4e00\u53f0 Master \u6216 LB \u5b95\u673a\u5747\u4e0d\u5f71\u54cd\u96c6\u7fa4\u53ef\u7528\u6027\u3002<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color:#333333\">3 \u53f0 Master&#xff1a;\u90e8\u7f72 API Server\u3001Scheduler\u3001Controller Manager \u53ca\u5185\u7f6e etcd&#xff0c;\u5f62\u6210 3 \u526f\u672c\u591a\u6570\u9009\u4e3e&#xff0c;\u53ef\u5bb9\u5fcd 1 \u53f0\u6545\u969c<\/span><\/li>\n<li><span style=\"color:#333333\">2 \u53f0 LB&#xff1a;Keepalived \u5b9e\u73b0 VIP \u6f02\u79fb&#xff0c;HAProxy \u5c06 6443 \u7aef\u53e3\u8d1f\u8f7d\u5747\u8861\u5230 3 \u4e2a Master<\/span><\/li>\n<li><span style=\"color:#333333\">3 \u53f0 Worker&#xff1a;\u8fd0\u884c\u4e1a\u52a1\u5de5\u4f5c\u8d1f\u8f7d<\/span><\/li>\n<li><span style=\"color:#333333\">1 \u53f0 Harbor&#xff1a;\u79c1\u6709\u955c\u50cf\u4ed3\u5e93&#xff08;\u72ec\u7acb\u8282\u70b9&#xff09;&#xff0c;\u63d0\u4f9b HTTPS \u4e0e\u955c\u50cf\u62c9\u53d6\u8ba4\u8bc1<\/span><\/li>\n<li><span style=\"color:#333333\">VIP&#xff1a;\u5916\u90e8\u7edf\u4e00\u901a\u8fc7\u865a\u62df IP \u8bbf\u95ee Kubernetes API Server<\/span><\/li>\n<\/ul>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">1.2 \u8282\u70b9\u6e05\u5355\u4e0e IP \u89c4\u5212<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6cbf\u7528\u73b0\u6709 10.10.10.0\/24 \u7f51\u6bb5\u3002\u4e3a\u907f\u5f00\u5df2\u6709\u4e3b\u673a&#xff08;\u5185\u7f51\u6e90 .10\u3001MGR .41-.43\u3001\u65e7 K8s .80-.84&#xff09;&#xff0c;\u89c4\u5212\u5982\u4e0b&#xff1a;<\/span><\/span><\/p>\n<table align=\"center\" border=\"1\" cellspacing=\"0\" style=\"width:420.0000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#1f4e79;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u4e3b\u673a\u540d<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u89d2\u8272<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">IP \u5730\u5740<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u90e8\u7f72\u7ec4\u4ef6<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">lb01<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8d1f\u8f7d\u5747\u8861<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.50<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Keepalived &#043; HAProxy<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">lb02<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8d1f\u8f7d\u5747\u8861<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.51<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Keepalived &#043; HAProxy<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">k8s-m1<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Master1<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.52<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">API Server \/ Scheduler \/ Controller Manager \/ etcd<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">k8s-m2<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Master2<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.53<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u540c\u4e0a<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">k8s-m3<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Master3<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.54<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u540c\u4e0a<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">k8s-w1<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Worker1<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.55<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubelet \/ kube-proxy \/ \u4e1a\u52a1 Pod<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">k8s-w2<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Worker2<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.56<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u540c\u4e0a<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">k8s-w3<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Worker3<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.57<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u540c\u4e0a<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:95.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">harbor<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u955c\u50cf\u4ed3\u5e93<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.58<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:145.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Harbor \u79c1\u6709\u4ed3\u5e93&#xff08;HTTPS&#xff09;<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u865a\u62df IP&#xff08;VIP&#xff09;&#xff1a;10.10.10.60&#xff08;\u7531 lb01\/lb02 \u4e0a\u7684 Keepalived \u7ba1\u7406&#xff0c;\u6b63\u5e38\u6302\u8f7d\u5728 lb01&#xff0c;\u6545\u969c\u6f02\u79fb\u5230 lb02&#xff09;\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">1.3 \u7248\u672c\u9009\u578b<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Rocky Linux 9.x \u4f7f\u7528 systemd &#043; NetworkManager&#xff0c;\u5185\u6838 cgroup v2&#xff0c;\u4e0e CentOS 7 \u5dee\u5f02\u8f83\u5927\u3002\u63a8\u8350\u7248\u672c\u5982\u4e0b&#xff1a;<\/span><\/span><\/p>\n<table align=\"center\" border=\"1\" cellspacing=\"0\" style=\"width:440.0000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#1f4e79;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u8f6f\u4ef6<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u7248\u672c<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:120.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u8bf4\u660e<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u64cd\u4f5c\u7cfb\u7edf<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Rocky Linux 9.5<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:120.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Minimal \u5b89\u88c5\u5373\u53ef<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Kubernetes<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">v1.36.x<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:120.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7a33\u5b9a\u7248&#xff0c;\u652f\u6301 Rocky 9<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5bb9\u5668\u8fd0\u884c\u65f6<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">containerd 2.x&#xff08;Rocky 9 \u81ea\u5e26&#xff09;<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:120.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u914d\u7f6e\u7ed3\u6784\u4e0d\u540c\u4e8e 1.x&#xff0c;\u89c1 4.4<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7f51\u7edc\u63d2\u4ef6<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Calico v3.32.2<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:120.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Pod \u7f51\u6bb5 10.244.0.0\/16<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8d1f\u8f7d\u5747\u8861<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:160.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Keepalived &#043; HAProxy<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:120.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7cfb\u7edf\u6e90\u81ea\u5e26<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7f51\u7edc\u6bb5\u89c4\u5212&#xff1a;Pod \u7f51\u6bb5 10.244.0.0\/16&#xff0c;Service \u7f51\u6bb5 10.96.0.0\/12&#xff08;\u5747\u4e3a Calico\/Flannel \u9ed8\u8ba4\u503c&#xff0c;\u53ef\u4fdd\u6301\u9ed8\u8ba4&#xff09;\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">1.4 \u8d44\u6e90\u5206\u914d\u5efa\u8bae<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7531\u4e8e Master \u5185\u7f6e etcd&#xff0c;\u5efa\u8bae Master \u8282\u70b9\u5185\u5b58\u4e0d\u4f4e\u4e8e 4GB\u3001CPU \u4e0d\u4f4e\u4e8e 2 \u6838&#xff1b;Worker \u8282\u70b9\u6309\u4e1a\u52a1\u8d1f\u8f7d\u5206\u914d&#xff0c;\u5efa\u8bae\u81f3\u5c11 2 \u6838 4GB\u3002VMware Workstation \u5355\u53f0\u5bbf\u4e3b\u5efa\u8bae\u5185\u5b58 32GB \u4ee5\u4e0a\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">1.5 \u7aef\u53e3\u6e05\u5355&#xff08;\u8fd0\u7ef4\u653e\u884c\u53c2\u8003&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u82e5\u542f\u7528\u4e86\u9632\u706b\u5899&#xff08;Rocky 9 \u9ed8\u8ba4 firewalld \u5df2\u5173\u95ed&#xff0c;\u6b64\u5904\u4f9b\u9700\u8981\u5f00\u9632\u706b\u5899\u7684\u573a\u666f\u53c2\u8003&#xff09;&#xff0c;\u9700\u653e\u884c\u4ee5\u4e0b\u7aef\u53e3&#xff1a;<\/span><\/span><\/p>\n<table align=\"center\" border=\"1\" cellspacing=\"0\" style=\"width:430.0000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#1f4e79;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u7aef\u53e3<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u534f\u8bae<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u7528\u9014<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#1f4e79;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:center\"><span style=\"color:#333333\"><span style=\"color:#ffffff\">\u8282\u70b9<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">6443<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Kubernetes API Server<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Master &#043; LB<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">2379\/2380<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">etcd \u5ba2\u6237\u7aef\/peer<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Master<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10250<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubelet API&#xff08;\u5065\u5eb7\u68c0\u67e5&#xff09;<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5168\u90e8\u8282\u70b9<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10259<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">kube-scheduler<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Master<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10257<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">kube-controller-manager<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Master<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">10256<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">kube-proxy<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5168\u90e8\u8282\u70b9<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">30000-32767<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">NodePort \u670d\u52a1\u7aef\u53e3\u6bb5<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5168\u90e8\u8282\u70b9<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">443<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Harbor HTTPS<\/span><\/span><\/p>\n<\/td>\n<td style=\"background-color:#eef3f9;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Harbor<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">5000<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:90.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">TCP<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:130.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Harbor HTTP&#xff08;\u53ef\u9009&#xff09;<\/span><\/span><\/p>\n<\/td>\n<td style=\"vertical-align:top;width:80.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Harbor<\/span><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6ce8&#xff1a;\u672c\u65b9\u6848\u5df2\u5173\u95ed firewalld&#xff1b;\u82e5\u9700\u5f00\u542f\u9632\u706b\u5899&#xff0c;\u8bf7\u6309\u4e0a\u8868\u653e\u884c\u5e76\u76f8\u5e94\u8c03\u6574\u3002<\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u4e8c\u7ae0 \u00a0\u57fa\u4e8e\u6807\u51c6\u673a\u514b\u9686\u51fa 9 \u53f0\u865a\u62df\u673a<\/span><\/span><\/h2>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">2.0 \u6267\u884c\u73af\u5883\u8bf4\u660e&#xff08;\u91cd\u8981&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u672c\u624b\u518c\u5927\u91cf\u547d\u4ee4\u6d89\u53ca\u7cfb\u7edf\u914d\u7f6e\u4e0e\u5305\u7ba1\u7406&#xff0c;\u9700\u533a\u5206\u6267\u884c\u8eab\u4efd&#xff1a;<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color:#333333\">\u5e26 sudo \u7684\u547d\u4ee4&#xff1a;\u4ee5\u666e\u901a\u7528\u6237\u6267\u884c&#xff0c;sudo \u9700\u8981\u8be5\u7528\u6237\u5df2\u52a0\u5165 wheel \u7ec4&#xff08;Rocky \u9ed8\u8ba4\u9996\u5efa\u7528\u6237\u5373 wheel \u6210\u5458&#xff09;<\/span><\/li>\n<li><span style=\"color:#333333\">\u4e0d\u5e26 sudo \u7684\u547d\u4ee4&#xff1a;\u5927\u591a\u53ef\u5728\u666e\u901a\u7528\u6237\u4e0b\u6267\u884c&#xff08;\u5982 kubectl\u3001docker\u3001openssl \u751f\u6210\u7b49&#xff09;&#xff0c;\u4f46\u5199 \/etc \u4e0b\u6587\u4ef6\u4ecd\u9700 sudo<\/span><\/li>\n<\/ul>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5efa\u8bae\u5168\u7a0b\u4f7f\u7528\u4e00\u4e2a\u666e\u901a\u7528\u6237&#xff08;\u5982\u767b\u5f55\u7528\u6237&#xff09;\u914d\u5408 sudo&#xff0c;\u907f\u514d\u76f4\u63a5\u4ee5 root \u64cd\u4f5c\u5e26\u6765\u7684\u6743\u9650\u4e60\u60ef\u4e0d\u4e00\u81f4&#xff1b;\u6d89\u53ca systemctl \u670d\u52a1\u7ba1\u7406\u3001\u5199 \/etc \u5747\u7528 sudo\u3002\u540e\u7eed\u547d\u4ee4\u7edf\u4e00\u6309\u6b64\u7ea6\u5b9a&#xff0c;\u4e0d\u518d\u9010\u4e00\u8bf4\u660e\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 VMware Workstation \u4e2d&#xff0c;\u5148\u51c6\u5907\u4e00\u53f0&#034;\u6807\u51c6\u673a&#034;&#xff08;Rocky 9.5 \u6700\u5c0f\u5316\u5b89\u88c5&#xff0c;\u914d\u7f6e\u597d\u57fa\u7840\u73af\u5883&#xff09;&#xff0c;\u518d\u7528\u5b83\u514b\u9686\u51fa 9 \u53f0\u8282\u70b9\u3002\u63a8\u8350\u4f7f\u7528&#034;\u94fe\u63a5\u514b\u9686&#034;\u4ee5\u8282\u7701\u78c1\u76d8&#xff0c;\u6216&#034;\u5b8c\u6574\u514b\u9686&#034;\u4fdd\u8bc1\u72ec\u7acb\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">2.1 \u6807\u51c6\u673a\u57fa\u7840\u914d\u7f6e<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6807\u51c6\u673a\u9700\u5b8c\u6210&#xff1a;\u6700\u5c0f\u5316\u5b89\u88c5\u3001\u914d\u7f6e\u9759\u6001 IP \u6a21\u677f\u3001\u5f00\u542f SSH\u3001\u914d\u7f6e hosts\u3001\u5b89\u88c5\u57fa\u7840\u5de5\u5177\u3002\u4ee5\u4e0b\u547d\u4ee4\u5728\u6807\u51c6\u673a\u4e0a\u6267\u884c&#xff0c;\u968f\u540e\u4f1a\u88ab\u514b\u9686\u7ee7\u627f\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;1&#xff09;\u914d\u7f6e\u9759\u6001\u7f51\u7edc&#xff08;Rocky 9 \u7528 nmcli \/ NetworkManager&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u6807\u51c6\u673a\u5148\u53d6\u4efb\u610f\u5360\u4f4d IP&#xff0c;\u514b\u9686\u540e\u518d\u9010\u53f0\u6539<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con mod ens160 ipv4.addresses 10.10.10.99\/24<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con mod ens160 ipv4.gateway 10.10.10.2<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con mod ens160 ipv4.dns 10.10.10.2,8.8.8.8<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con mod ens160 ipv4.method manual<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con up ens160<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;2&#xff09;\u5173\u95ed\u9632\u706b\u5899\u3001SELinux&#xff08;\u751f\u4ea7\u5982\u9700\u9632\u706b\u5899\u53ef\u540e\u7eed\u6309\u7aef\u53e3\u653e\u884c&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl disable &#8211;now firewalld<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo sed -i &#034;s\/^SELINUX&#061;.*\/SELINUX&#061;disabled\/&#034; \/etc\/selinux\/config<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo setenforce 0<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;3&#xff09;\u5b89\u88c5\u57fa\u7840\u5de5\u5177\u4e0e\u65f6\u95f4\u540c\u6b65&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y vim net-tools wget curl bash-completion chrony ipvsadm ipset<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl enable &#8211;now chronyd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;4&#xff09;\u914d\u7f6e\u7edf\u4e00 hosts&#xff08;9 \u53f0\u6700\u7ec8\u4e00\u81f4&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u8ffd\u52a0\u5230 \/etc\/hosts<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo bash -c &#039;cat &gt;&gt; \/etc\/hosts &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.50 lb01<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.51 lb02<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.52 k8s-m1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.53 k8s-m2<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.54 k8s-m3<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.55 k8s-w1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.56 k8s-w2<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.57 k8s-w3<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">10.10.10.58 harbor<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF&#039;<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">2.2 VMware Workstation \u514b\u9686\u6b65\u9aa4<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;1&#xff09;\u6807\u51c6\u673a\u9700\u5148\u5173\u673a&#xff0c;\u53f3\u952e\u865a\u62df\u673a \u2192 \u7ba1\u7406 \u2192 \u514b\u9686\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;2&#xff09;\u514b\u9686\u7c7b\u578b\u9009&#034;\u521b\u5efa\u94fe\u63a5\u514b\u9686&#034;&#xff08;\u7701\u78c1\u76d8&#xff0c;\u4f46\u6e90\u673a\u4e0d\u80fd\u5220&#xff09;&#xff1b;\u751f\u4ea7\u66f4\u63a8\u8350&#034;\u521b\u5efa\u5b8c\u6574\u514b\u9686&#034;\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;3&#xff09;\u9010\u53f0\u514b\u9686 9 \u6b21&#xff0c;\u5206\u522b\u547d\u540d lb01\u3001lb02\u3001k8s-m1\u3001k8s-m2\u3001k8s-m3\u3001k8s-w1\u3001k8s-w2\u3001k8s-w3\u3001harbor\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">&#xff08;4&#xff09;\u514b\u9686\u5b8c\u6210\u540e\u9010\u53f0\u542f\u52a8&#xff0c;\u4f9d\u6b21\u4fee\u6539\u4e3b\u673a\u540d\u4e0e IP\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">2.3 \u9010\u53f0\u8bbe\u7f6e\u4e3b\u673a\u540d<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># lb01 \/ lb02 \/ k8s-m1 \/ k8s-m2 \/ k8s-m3 \/ k8s-w1 \/ k8s-w2 \/ k8s-w3 \/ harbor \u5206\u522b\u6267\u884c<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo hostnamectl set-hostname lb01 \u00a0\u00a0\u00a0# \u5176\u4f59\u8282\u70b9\u6362\u6210\u5404\u81ea\u4e3b\u673a\u540d<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo bash<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">2.4 \u9010\u53f0\u4fee\u6539\u9759\u6001 IP<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u4ee5 k8s-m1 \u4e3a\u4f8b&#xff08;\u6539 ipv4.addresses \u4e3a\u5bf9\u5e94 IP&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con mod ens160 ipv4.addresses 10.10.10.52\/24<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con mod ens160 ipv4.gateway 10.10.10.2<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con mod ens160 ipv4.dns 10.10.10.2,8.8.8.8<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo nmcli con up ens160<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">hostnamectl set-hostname k8s-m1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">bash<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6bcf\u53f0\u514b\u9686\u673a\u91cd\u590d\u4e0a\u8ff0\u64cd\u4f5c&#xff0c;\u76f4\u81f3 9 \u53f0\u4e3b\u673a\u540d\u3001IP\u3001hosts \u5168\u90e8\u5c31\u4f4d\u3002\u7528 ping \u9a8c\u8bc1\u5404\u8282\u70b9\u4e92\u901a\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6700\u540e\u786e\u8ba4\u5404\u8282\u70b9\u662f Rocky 9\u3001\u5185\u6838\u4e0e\u65f6\u95f4\u6b63\u5e38&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">cat \/etc\/rocky-release<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">uname -r<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">date<\/span><\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u4e09\u7ae0 \u00a0\u90e8\u7f72\u8d1f\u8f7d\u5747\u8861\u5c42&#xff08;Keepalived &#043; HAProxy&#xff09;<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8d1f\u8f7d\u5747\u8861\u5c42\u8dd1\u5728 lb01\u3001lb02 \u4e24\u53f0\u8282\u70b9\u4e0a&#xff0c;\u4f5c\u7528\u6709\u4e8c&#xff1a;\u4e00\u662f\u7528 HAProxy \u5c06\u5ba2\u6237\u7aef\u5bf9 6443 \u7aef\u53e3\u7684\u8bbf\u95ee\u5206\u53d1\u5230 3 \u4e2a Master \u7684 API Server&#xff1b;\u4e8c\u662f\u7528 Keepalived \u7ef4\u62a4\u865a\u62df IP 10.10.10.60&#xff0c;\u5b9e\u73b0\u4e3b\u5907\u6f02\u79fb\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">3.1 \u5b89\u88c5 Keepalived \u4e0e HAProxy<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y keepalived haproxy<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">3.2 LB \u8282\u70b9\u5185\u6838\u53c2\u6570&#xff08;\u751f\u4ea7\u589e\u5f3a&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5efa\u8bae\u5728 lb01\u3001lb02 \u4e0a\u540c\u6837\u5f00\u542f IP \u8f6c\u53d1&#xff0c;\u907f\u514d\u7279\u6b8a\u7f51\u7edc\u573a\u666f\u4e0b VIP \u8f6c\u53d1\u5f02\u5e38&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/sysctl.d\/99-lb.conf &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">net.ipv4.ip_forward &#061; 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo sysctl &#8211;system<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sysctl net.ipv4.ip_forward \u00a0\u00a0# \u671f\u671b\u8f93\u51fa 1<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">3.3 \u914d\u7f6e HAProxy&#xff08;lb01 \u4e0e lb02 \u76f8\u540c&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">HAProxy \u9700\u540c\u65f6\u914d\u7f6e global \u65e5\u5fd7\u4e0e\u540e\u7aef\u8d1f\u8f7d\u5747\u8861\u3002\u4e3a\u4f7f\u6545\u969c\u6392\u67e5\u80fd\u770b\u5230\u540e\u7aef\u8282\u70b9\u5065\u5eb7\u68c0\u67e5\u65e5\u5fd7&#xff0c;\u542f\u7528 log-health-checks \u5e76\u4ea4\u7ed9 rsyslog \u6536\u96c6\u3002\u5b8c\u6574\u66ff\u6362 \/etc\/haproxy\/haproxy.cfg&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/haproxy\/haproxy.cfg &lt;&lt;&#039;EOF&#039;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">global<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0log \/dev\/log local0 info<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0maxconn 4096<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0user haproxy<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0group haproxy<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0daemon<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">defaults<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0log global<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0mode tcp<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0option tcplog<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0option log-health-checks<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0timeout connect 5s<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0timeout client 50s<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0timeout server 50s<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">listen kubernetes-apiserver<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0bind 0.0.0.0:6443<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0balance roundrobin<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0server k8s-m1 10.10.10.52:6443 check inter 3s fall 3 rise 3<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0server k8s-m2 10.10.10.53:6443 check inter 3s fall 3 rise 3<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0server k8s-m3 10.10.10.54:6443 check inter 3s fall 3 rise 3<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo haproxy -c -f \/etc\/haproxy\/haproxy.cfg<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl enable &#8211;now haproxy<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl status haproxy<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8ba9 rsyslog \u5355\u72ec\u6536\u96c6 haproxy \u65e5\u5fd7&#xff0c;\u4fbf\u4e8e\u67e5\u770b\u5065\u5eb7\u68c0\u67e5\u4e0e\u8bbf\u95ee\u8bb0\u5f55&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/rsyslog.d\/haproxy.conf &lt;&lt;&#039;EOF&#039;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">:programname, isequal, &#034;haproxy&#034; \/var\/log\/haproxy.log<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">&amp; stop<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl restart rsyslog<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u67e5\u770b\u5065\u5eb7\u68c0\u67e5\u4e0e\u8bbf\u95ee\u65e5\u5fd7&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tail -f \/var\/log\/haproxy.log<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">3.4 \u914d\u7f6e Keepalived&#xff08;lb01 \u4e3b\u3001lb02 \u5907&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5065\u5eb7\u68c0\u67e5\u5efa\u8bae\u91c7\u7528\u811a\u672c\u65b9\u5f0f&#xff1a;\u65e2\u68c0\u6d4b haproxy \u8fdb\u7a0b\u5b58\u6d3b&#xff0c;\u53c8\u68c0\u6d4b 6443 \u7aef\u53e3\u662f\u5426\u5b9e\u9645\u76d1\u542c&#xff0c;\u907f\u514d\u300c\u8fdb\u7a0b\u5047\u6b7b\u3001VIP \u4e0d\u6f02\u79fb\u300d\u7684\u95ee\u9898\u3002\u5148\u521b\u5efa\u5065\u5eb7\u68c0\u67e5\u811a\u672c&#xff08;\u4e24\u53f0 LB \u4e00\u81f4&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \/etc\/keepalived\/check_haproxy.sh<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/keepalived\/check_haproxy.sh &lt;&lt;&#039;EOF&#039;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">#!\/bin\/bash<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># haproxy \u8fdb\u7a0b\u5b58\u6d3b\u68c0\u67e5<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">if ! pgrep -x haproxy &gt;\/dev\/null; then<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0exit 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">fi<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># 6443 \u7aef\u53e3\u76d1\u542c\u68c0\u67e5<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">if ! (echo &gt; \/dev\/tcp\/127.0.0.1\/6443) 2&gt;\/dev\/null; then<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0exit 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">fi<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">exit 0<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo chmod &#043;x \/etc\/keepalived\/check_haproxy.sh<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u4e3b\u8282\u70b9 lb01 \u914d\u7f6e \/etc\/keepalived\/keepalived.conf&#xff0c;vrrp_script \u6539\u4e3a\u8c03\u7528\u8be5\u811a\u672c&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># lb01 \u4e3b\u8282\u70b9<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">global_defs {<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0router_id K8S_LB_1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">}<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">vrrp_script chk_haproxy {<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0script &#034;\/etc\/keepalived\/check_haproxy.sh&#034;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0interval 2<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0weight 2<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">}<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">vrrp_instance K8S_LB {<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0state MASTER<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0interface ens160<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0virtual_router_id 51<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0priority 150<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0advert_int 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0authentication {<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0auth_type PASS<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0auth_pass K8S_LB_PASS<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0virtual_ipaddress {<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a010.10.10.60\/24<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0track_script {<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0chk_haproxy<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">}<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5907\u8282\u70b9 lb02 \u914d\u7f6e\u57fa\u672c\u76f8\u540c&#xff0c;\u4ec5\u9700\u6539\u4e09\u5904&#xff1a;router_id\u3001state \u6539\u4e3a BACKUP\u3001priority \u964d\u4f4e&#xff08;\u5982 100&#xff09;\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># lb02 \u5907\u8282\u70b9&#xff1a;\u4e09\u5904\u4e0d\u540c<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0router_id K8S_LB_2<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0state BACKUP<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0priority 100<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">keepalived.conf \u4e2d\u542b VRRP \u8ba4\u8bc1\u5bc6\u7801&#xff0c;\u9700\u6536\u7d27\u6587\u4ef6\u6743\u9650\u9632\u6b62\u6cc4\u9732&#xff08;\u4ec5 root \u53ef\u8bfb\u5199&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo chmod 600 \/etc\/keepalived\/keepalived.conf<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo chown root:root \/etc\/keepalived\/keepalived.conf<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl enable &#8211;now keepalived<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl status keepalived<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8bf4\u660e&#xff1a;VRRP \u8ba4\u8bc1 (auth_type PASS) \u4ec5\u7528\u4e8e\u7ec4\u5185\u8282\u70b9\u95f4\u7b80\u5355\u9274\u6743&#xff0c;\u5bc6\u7801\u4ee5\u660e\u6587\u5b58\u50a8\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d&#xff0c;\u56e0\u6b64 600 \u6743\u9650\u662f\u5fc5\u8981\u52a0\u56fa&#xff1b;\u66f4\u5b89\u5168\u7684\u65b9\u5f0f\u662f\u4f7f\u7528 AH \u8ba4\u8bc1\u6216\u9650\u5236\u63a5\u53e3\u8bbf\u95ee\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">3.5 \u9a8c\u8bc1\u8d1f\u8f7d\u5747\u8861\u5c42<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728\u4efb\u4e00\u8282\u70b9\u67e5\u770b VIP \u662f\u5426\u6f02\u79fb\u6b63\u5e38&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">ip addr show ens160 \u00a0\u00a0# \u671f\u671b\u770b\u5230 10.10.10.60 \u5728 lb01 \u4e0a<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">ping -c 2 10.10.10.60<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u624b\u52a8\u9a8c\u8bc1\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u903b\u8f91\u662f\u5426\u6b63\u786e&#xff08;\u6b64\u65f6 Master \u5c1a\u672a\u90e8\u7f72&#xff0c;6443 \u7aef\u53e3\u672a\u76d1\u542c&#xff0c;\u811a\u672c\u5e94\u8fd4\u56de 1&#xff0c;Keepalived \u4f1a\u5224\u5b9a\u4e3b\u8282\u70b9\u4e0d\u5065\u5eb7&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo \/etc\/keepalived\/check_haproxy.sh; echo $? \u00a0\u00a0# \u671f\u671b\u8f93\u51fa 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u5f85 Master \u90e8\u7f72\u540e\u518d\u6b21\u6267\u884c&#xff0c;\u671f\u671b\u8f93\u51fa 0<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6d4b\u8bd5 6443 \u7aef\u53e3\u8f6c\u53d1&#xff08;\u6b64\u65f6 Master \u5c1a\u672a\u90e8\u7f72&#xff0c;TCP \u8fde\u63a5\u4f1a\u5931\u8d25\u5c5e\u6b63\u5e38&#xff1b;\u7aef\u53e3\u53ef\u8fbe\u5373\u53ef&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">nc -vz 10.10.10.60 6443<\/span><\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u56db\u7ae0 \u00a0\u90e8\u7f72\u5bb9\u5668\u8fd0\u884c\u65f6\u4e0e Kubernetes \u7ec4\u4ef6<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u672c\u7ae0\u5728 3 \u53f0 Master \u548c 3 \u53f0 Worker \u5171 6 \u53f0\u8282\u70b9\u4e0a\u6267\u884c&#xff08;LB \u8282\u70b9\u4e0d\u9700\u8981&#xff09;\u3002\u5305\u62ec&#xff1a;\u52a0\u8f7d\u5185\u6838\u6a21\u5757\u3001\u914d\u7f6e sysctl\u3001\u5b89\u88c5 containerd\u3001\u914d\u7f6e K8s \u8f6f\u4ef6\u6e90\u5e76\u5b89\u88c5 kubeadm \/ kubelet \/ kubectl\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">4.1 \u52a0\u8f7d\u5185\u6838\u6a21\u5757&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u52a0\u8f7d overlay \u4e0e br_netfilter<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo modprobe overlay<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo modprobe br_netfilter<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/modules-load.d\/containerd.conf &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">overlay<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">br_netfilter<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">4.2 \u914d\u7f6e\u5185\u6838\u53c2\u6570&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">K8s \u5b98\u65b9\u8981\u6c42\u7684\u5185\u6838\u53c2\u6570\u4ec5\u9700\u5f00\u542f iptables \u6865\u63a5\u8f6c\u53d1\u4e0e IP \u8f6c\u53d1&#xff1b;vm.swappiness \u4e0d\u5c5e\u4e8e K8s \u5f3a\u5236\u9879&#xff0c;\u6545\u4e0d\u5728\u6b64\u8bbe\u7f6e&#xff08;\u8be6\u89c1 4.3 \u8bf4\u660e&#xff09;\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/sysctl.d\/99-kubernetes.conf &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">net.bridge.bridge-nf-call-iptables \u00a0&#061; 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">net.bridge.bridge-nf-call-ip6tables &#061; 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">net.ipv4.ip_forward \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#061; 1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo sysctl &#8211;system<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">4.3 \u5173\u95ed swap&#xff08;Rocky 9 \u9ed8\u8ba4\u7cfb\u7edf\u65e0 swap&#xff0c;\u5982\u6709\u5219\u5173\u95ed&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5173\u95ed swap \u662f K8s \u786c\u6027\u8981\u6c42&#xff1a;kubelet \u68c0\u6d4b\u5230\u8282\u70b9\u6709 swap \u65f6\u9ed8\u8ba4\u62d2\u7edd\u542f\u52a8&#xff08;failSwapOn&#xff09;\u3002Rocky 9 \u9ed8\u8ba4\u65e0 swap&#xff0c;\u82e5\u5f00\u542f\u4e86\u5219\u6267\u884c&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo swapoff -a<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo sed -i &#034;\/ swap \/ s\/^\/#\/&#034; \/etc\/fstab<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">4.4 \u5b89\u88c5 containerd&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y yum-utils<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># Rocky 9 \u81ea\u5e26 containerd \u5305&#xff1b;\u4e5f\u53ef\u7528 docker-ce \u6e90\u88c5 containerd.io<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y containerd.io<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo mkdir -p \/etc\/containerd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo containerd config default | sudo tee \/etc\/containerd\/config.toml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Rocky 9 \u9ed8\u8ba4\u81ea\u5e26 containerd 2.x&#xff08;\u914d\u7f6e\u7ed3\u6784\u4e0d\u540c\u4e8e 1.x&#xff09;&#xff1a;sandbox \u955c\u50cf\u4f4d\u4e8e pinned_images.sandbox&#xff08;\u800c\u975e sandbox_image&#xff09;&#xff0c;\u63d2\u4ef6\u6bb5\u4e3a plugins.io.containerd.cri.v1.images\u30024.6 \u7684 pause \u66ff\u6362\u4e0e\u4e0b\u65b9 cgroup \u914d\u7f6e\u5747\u5df2\u6309 2.x \u9002\u914d\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Rocky 9 \u4f7f\u7528 cgroup v2&#xff0c;\u5fc5\u987b\u5c06 containerd \u7684 cgroup \u9a71\u52a8\u6539\u4e3a systemd&#xff08;\u4e0e kubelet \u4e00\u81f4&#xff0c;\u907f\u514d cgroup v2 \u4e0b\u9a71\u52a8\u51b2\u7a81\u5bfc\u81f4\u8282\u70b9 NotReady&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo sed -i &#034;s\/SystemdCgroup &#061; false\/SystemdCgroup &#061; true\/&#034; \/etc\/containerd\/config.toml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl enable &#8211;now containerd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u914d\u7f6e\u5df2\u4fee\u6539&#xff0c;\u5fc5\u987b restart \u91cd\u8f7d&#xff0c;\u5426\u5219\u6539\u52a8\u4e0d\u751f\u6548<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl restart containerd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl status containerd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8bf4\u660e&#xff1a;enable &#8211;now \u4ec5\u5728\u670d\u52a1\u9996\u6b21\u542f\u52a8\u65f6\u8bfb\u53d6\u914d\u7f6e&#xff1b;\u82e5 containerd \u5df2\u5728\u8fd0\u884c&#xff08;\u5b89\u88c5\u5305\u65f6\u901a\u5e38\u5df2\u542f\u52a8&#xff09;&#xff0c;\u5fc5\u987b\u5148 restart \u624d\u80fd\u91cd\u8f7d\u4fee\u6539\u540e\u7684 config.toml\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u4fee\u6539\u540e\u52a1\u5fc5\u786e\u8ba4 cgroup \u9a71\u52a8\u786e\u5b9e\u751f\u6548\u4e3a systemd&#xff08;\u800c\u975e\u9ed8\u8ba4\u7684 cgroupfs&#xff09;&#xff0c;\u8fd9\u4e00\u6b65\u9057\u6f0f\u4f1a\u5bfc\u81f4 kubelet \u65e0\u6cd5\u542f\u52a8\u3002\u6ce8\u610f&#xff1a;Rocky 9 \u5b89\u88c5 containerd \u540e crictl \u9ed8\u8ba4\u53ef\u80fd\u672a\u5b89\u88c5&#xff0c;\u9700\u5148\u88c5 cri-tools&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u82e5\u63d0\u793a crictl: command not found&#xff0c;\u5148\u5b89\u88c5 cri-tools<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y cri-tools<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo crictl info | grep -A5 -i cgroup<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u671f\u671b\u8f93\u51fa: &#034;cgroupDriver&#034;: &#034;systemd&#034;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u82e5\u663e\u793a cgroupfs \u6216 cgroupDriver \u975e systemd&#xff0c;\u8bf4\u660e\u914d\u7f6e\u672a\u751f\u6548&#xff0c;\u9700\u68c0\u67e5 config.toml \u7684 SystemdCgroup \u662f\u5426\u4e3a true \u5e76\u91cd\u65b0 restart\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7edf\u4e00 crictl \u7684 runtime-endpoint&#xff08;\u751f\u4ea7\u589e\u5f3a&#xff0c;\u53ef\u9009&#xff09;&#xff1a;crictl \u9ed8\u8ba4 socket \u8def\u5f84\u591a\u6570\u73af\u5883\u6b63\u786e&#xff0c;\u4f46\u90e8\u5206\u73af\u5883\u4f1a\u5f02\u5e38&#xff0c;\u5efa\u8bae\u663e\u5f0f\u914d\u7f6e \/etc\/crictl.yaml \u4fdd\u8bc1 crictl \u80fd\u6b63\u5e38\u8fde\u63a5 containerd&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/crictl.yaml &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">runtime-endpoint: unix:\/\/\/run\/containerd\/containerd.sock<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">image-endpoint: unix:\/\/\/run\/containerd\/containerd.sock<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">timeout: 10<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">debug: false<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo crictl info \u00a0\u00a0\u00a0# \u9a8c\u8bc1 crictl \u53ef\u6b63\u5e38\u8fde\u63a5<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">pause \u955c\u50cf\u7684\u56fd\u5185\u6e90\u66ff\u6362\u653e\u5230 4.6 \u5b89\u88c5 kubeadm \u4e4b\u540e\u6267\u884c&#xff0c;\u8fd9\u6837\u80fd\u7528 kubeadm \u81ea\u52a8\u63a2\u6d4b\u5f53\u524d\u7248\u672c\u7684\u51c6\u786e tag&#xff0c;\u907f\u514d\u5199\u6b7b tag \u5bfc\u81f4\u7248\u672c\u4e0d\u5339\u914d&#xff08;\u8be6\u89c1 4.6&#xff09;\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">4.5 \u914d\u7f6e K8s \u8f6f\u4ef6\u6e90&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">K8s \u4ece v1.28 \u8d77 yum \u6e90\u6539\u4e3a\u6309\u5927\u7248\u672c\u5206\u76ee\u5f55&#xff0c;\u65e7\u8def\u5f84&#xff08;mirrors.aliyun.com\/kubernetes\/yum\/repos\/&#8230;&#xff09;\u5bf9\u65b0\u7248\u672c\u4f1a\u8fd4\u56de 404&#xff0c;\u5fc5\u987b\u4f7f\u7528\u5b98\u65b9 pkgs.k8s.io \u6e90&#xff08;\u6309\u5927\u7248\u672c\u76ee\u5f55&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/yum.repos.d\/kubernetes.repo &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">[kubernetes]<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">name&#061;Kubernetes<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">baseurl&#061;https:\/\/pkgs.k8s.io\/core:\/stable:\/v1.36\/rpm\/<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">enabled&#061;1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">gpgcheck&#061;1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">gpgkey&#061;https:\/\/pkgs.k8s.io\/core:\/stable:\/v1.36\/rpm\/repodata\/repomd.xml.key<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">repo_gpgcheck&#061;1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8bf4\u660e&#xff1a;\u5b98\u65b9\u6e90\u5e26 gpg \u6821\u9a8c\u3002\u82e5\u5185\u7f51\u8bbf\u95ee pkgs.k8s.io \u53d7\u9650&#xff0c;\u53ef\u7528 dnf makecache \u6d4b\u8bd5\u8fde\u901a\u6027&#xff0c;\u6216\u6539\u7528\u5185\u7f51 yum \u6e90&#xff08;10.10.10.10 \u5f6d\u5927\u5e05\u6e90&#xff09;\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">4.6 \u5b89\u88c5 kubeadm \/ kubelet \/ kubectl&#xff08;6 \u8282\u70b9&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6307\u5b9a v1.36 \u7a33\u5b9a\u7248\u672c&#xff08;\u5982\u5b89\u88c5\u65f6\u5df2\u6709\u66f4\u65b0\u7248\u672c&#xff0c;\u53ef\u7528 yum \u641c\u7d22\u786e\u5b9a&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y kubelet-1.36.0 kubeadm-1.36.0 kubectl-1.36.0<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u82e5\u7248\u672c\u53f7\u6709\u51fa\u5165&#xff0c;\u5148\u67e5\u8be2\u53ef\u7528\u7248\u672c<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf list &#8211;available kubelet kubeadm kubectl<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl enable &#8211;now kubelet<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6ce8&#xff1a;kubelet \u73b0\u5728\u542f\u52a8\u4f1a\u5931\u8d25\u5c5e\u6b63\u5e38&#xff08;\u7f3a\u5c11\u96c6\u7fa4\u914d\u7f6e&#xff09;&#xff0c;\u7b49\u521d\u59cb\u5316\u540e\u5373\u6b63\u5e38\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u52a8\u6001\u4fee\u6b63 pause \u955c\u50cf\u4e3a\u56fd\u5185\u6e90&#xff1a;\u5148\u7528 kubeadm \u63a2\u6d4b\u5f53\u524d\u7248\u672c\u771f\u5b9e\u7684 pause \u955c\u50cf\u540d&#xff08;\u542b tag&#xff0c;\u907f\u514d\u5199\u6b7b\u7248\u672c\u4e0d\u5339\u914d&#xff09;&#xff0c;\u518d\u66ff\u6362 containerd \u914d\u7f6e\u4e2d\u7684 registry \u524d\u7f00\u3002\u8fd9\u6837 tag \u59cb\u7ec8\u4e0e kubeadm \u7248\u672c\u5bf9\u9f50&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># 1. \u67e5\u770b\u5f53\u524d\u7248\u672c pause \u955c\u50cf&#xff08;registry.k8s.io\/pause:&lt;tag&gt;&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubeadm config images list | grep pause<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># 2. \u81ea\u52a8\u63d0\u53d6\u5f53\u524d pause \u955c\u50cf\u5e76\u6362\u6210\u963f\u91cc\u4e91&#xff08;sed \u76f4\u63a5\u63a5\u7ba1\u9053&#xff0c;\u907f\u514d\u5d4c\u5957&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">PAUSE_IMG&#061;$(kubeadm config images list | grep pause | head -1 | sed &#034;s#registry.k8s.io#registry.aliyuncs.com\/google_containers#&#034;)<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># 3. \u66ff\u6362 containerd \u7684 sandbox \u955c\u50cf&#xff08;containerd 2.x \u7528 pinned_images.sandbox&#xff0c;\u975e sandbox_image&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo sed -i &#034;s#registry.k8s.io\/pause:#$PAUSE_IMG#&#034; \/etc\/containerd\/config.toml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># 4. \u786e\u8ba4\u66ff\u6362\u7ed3\u679c\u5e76\u91cd\u542f containerd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">grep -n &#034;pause:&#034; \/etc\/containerd\/config.toml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl restart containerd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8bf4\u660e&#xff1a;\u6b64\u65b9\u5f0f\u7528 kubeadm \u81ea\u52a8\u63a2\u6d4b tag&#xff0c;\u4e0d\u4f9d\u8d56\u624b\u5de5\u5199\u6b7b\u7684\u7248\u672c\u53f7&#xff0c;\u4ece\u6839\u6e90\u4e0a\u907f\u514d pause \u7248\u672c\u4e0e K8s \u7248\u672c\u4e0d\u5339\u914d\u5bfc\u81f4\u7684\u8282\u70b9 NotReady\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">4.7 \u9a8c\u8bc1\u57fa\u7840\u73af\u5883<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">containerd &#8211;version<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubeadm version<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl version &#8211;client<\/span><\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u4e94\u7ae0 \u00a0\u521d\u59cb\u5316\u9ad8\u53ef\u7528\u63a7\u5236\u9762&#xff08;Master&#xff09;<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 k8s-m1 \u4e0a\u521b\u5efa kubeadm \u521d\u59cb\u5316\u914d\u7f6e\u6587\u4ef6\u3002\u5173\u952e\u70b9&#xff1a;&#8211;control-plane-endpoint \u6307\u5411\u8d1f\u8f7d\u5747\u8861 VIP 10.10.10.60:6443&#xff0c;\u4f7f\u6240\u6709 Master \u901a\u8fc7 VIP \u901a\u4fe1&#xff1b;advertiseAddress \u586b\u672c\u673a\u771f\u5b9e IP\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">5.1 \u751f\u6210\u5e76\u4fee\u6539\u521d\u59cb\u5316\u914d\u7f6e&#xff08;k8s-m1 \u6267\u884c&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">print init-defaults \u4f1a\u8f93\u51fa\u5927\u91cf\u9ed8\u8ba4\u5b57\u6bb5\u3002\u4e3a\u907f\u514d\u8bef\u6539&#xff0c;\u52a1\u5fc5\u9075\u5faa\u300c\u53ea\u6539\u4ee5\u4e0b\u5fc5\u8981\u5b57\u6bb5&#xff0c;\u5176\u4f59\u9ed8\u8ba4\u503c\u4e00\u5f8b\u4e0d\u52a8\u300d\u7684\u539f\u5219&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm config print init-defaults &gt; kubeadm-init.yaml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo vim kubeadm-init.yaml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6ce8\u610f&#xff1a;kubeadm config print \u5728 root \u4e0b\u6267\u884c\u65e0\u9700 sudo&#xff0c;\u4f46\u666e\u901a\u7528\u6237\u9700 sudo&#xff1b;\u751f\u6210\u7684\u662f root \u5c5e\u4e3b\u6587\u4ef6&#xff0c;vim \u7f16\u8f91\u4e5f\u9700 sudo\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">vim \u4e2d\u53ea\u9700\u6539 4 \u5904&#xff0c;\u5176\u4f59\u4fdd\u6301\u9ed8\u8ba4&#xff08;controlPlaneEndpoint \u4e3a\u9ad8\u53ef\u7528\u6838\u5fc3&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u2460 \u672c\u673a\u771f\u5b9e IP&#xff08;\u9ed8\u8ba4 1.2.3.4&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0advertiseAddress: 10.10.10.52<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u2461 \u9ad8\u53ef\u7528\u6838\u5fc3&#xff1a;\u5fc5\u987b\u624b\u52a8\u65b0\u589e\u8be5\u5b57\u6bb5&#xff0c;\u6307\u5411 VIP<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0controlPlaneEndpoint: 10.10.10.60:6443<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u2462 \u4e0e\u5b89\u88c5\u7248\u672c\u4e00\u81f4<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0kubernetesVersion: v1.36.0<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u2463 \u56fd\u5185\u955c\u50cf\u6e90&#xff08;\u66ff\u6362 registry.k8s.io&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0imageRepository: registry.aliyuncs.com\/google_containers<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Pod \u7f51\u6bb5\u9ed8\u8ba4 10.244.0.0\/16\u3001Service \u7f51\u6bb5\u9ed8\u8ba4 10.96.0.0\/12&#xff0c;\u5df2\u4e0e Calico \u517c\u5bb9&#xff0c;\u65e0\u9700\u4fee\u6539\u3002\u82e5\u4f60\u786e\u9700\u6539\u7f51\u6bb5&#xff0c;\u518d\u8c03\u6574 networking \u6bb5\u4e14\u4e24\u5904\u9700\u4e00\u81f4\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">5.2 \u6821\u9a8c\u914d\u7f6e\u8bed\u6cd5&#xff08;\u5f3a\u70c8\u5efa\u8bae&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7528 kubeadm migrate \u6821\u9a8c\u914d\u7f6e&#xff0c;\u907f\u514d\u5b57\u6bb5\u5199\u9519\u5bfc\u81f4 init \u5931\u8d25&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm config migrate &#8211;old-config kubeadm-init.yaml &#8211;new-config kubeadm-init-new.yaml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo vim kubeadm-init.yaml \u00a0\u00a0# \u4eba\u5de5\u590d\u6838\u4e0a\u8ff0 4 \u5904<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">5.3 \u9884\u62c9\u53d6\u955c\u50cf&#xff08;\u53ef\u9009&#xff0c;\u52a0\u901f\u521d\u59cb\u5316&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm config images pull &#8211;config kubeadm-init.yaml<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">5.4 \u521d\u59cb\u5316\u7b2c\u4e00\u4e2a\u63a7\u5236\u9762\u8282\u70b9&#xff08;k8s-m1&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u9884\u68c0\u63d0\u9192&#xff1a;kubeadm \u8981\u6c42\u63a7\u5236\u9762\u8282\u70b9 CPU \u2265 2 \u6838\u3002\u82e5\u865a\u62df\u673a\u53ea\u6709 1 \u6838&#xff0c;init \u4f1a\u62a5 [ERROR NumCPU]&#xff0c;\u9700\u5148\u5728 VMware \u4e2d\u5173\u95ed\u865a\u62df\u673a\u5c06 CPU \u8c03\u81f3 2 \u6838&#xff0c;\u518d\u91cd\u65b0 init\u3002\u751f\u4ea7 Master \u5efa\u8bae 2 \u6838 4GB \u4ee5\u4e0a\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u4e3b\u673a\u540d\u63d0\u9192&#xff1a;kubeadm init \u4f1a\u628a\u8282\u70b9\u6ce8\u518c\u4e3a\u5f53\u524d\u4e3b\u673a\u540d\u3002\u52a1\u5fc5\u5148\u786e\u8ba4 k8s-m1 \u4e3b\u673a\u540d\u6b63\u786e&#xff08;hostname \u663e\u793a k8s-m1&#xff09;&#xff0c;\u5426\u5219\u96c6\u7fa4\u4e2d\u7b2c\u4e00\u53f0 Master \u7684\u8282\u70b9\u540d\u4f1a\u662f\u65e7\u4e3b\u673a\u540d&#xff08;\u5982 node&#xff09;&#xff0c;\u540e\u7eed\u9700\u989d\u5916\u5904\u7406\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">hostname \u00a0\u00a0# \u786e\u8ba4\u663e\u793a k8s-m1&#xff0c;\u518d\u6267\u884c init<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm init &#8211;config kubeadm-init.yaml &#8211;upload-certs<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u521d\u59cb\u5316\u6210\u529f\u540e&#xff0c;\u672b\u5c3e\u4f1a\u8f93\u51fa\u4e24\u6761\u5173\u952e join \u547d\u4ee4&#xff0c;\u52a1\u5fc5\u7acb\u5373\u4fdd\u5b58&#xff08;\u6709\u6548\u671f\u4e0d\u540c&#xff0c;\u8be6\u89c1 5.6&#xff09;&#xff1a;<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color:#333333\">kubeadm join \u547d\u4ee4&#xff08;\u52a0\u5165 Master \u7684 &#8211;control-plane \u547d\u4ee4&#xff0c;\u542b &#8211;certificate-key&#xff09;<\/span><\/li>\n<li><span style=\"color:#333333\">kubeadm join \u547d\u4ee4&#xff08;\u52a0\u5165 Worker \u7684\u666e\u901a\u547d\u4ee4&#xff0c;\u542b token&#xff09;<\/span><\/li>\n<\/ul>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">5.5 \u914d\u7f6e kubectl&#xff08;k8s-m1&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">mkdir -p $HOME\/.kube<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo cp -i \/etc\/kubernetes\/admin.conf $HOME\/.kube\/config<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo chown <\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">(id -g) $HOME\/.kube\/config<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u542f\u7528 kubectl \u81ea\u52a8\u8865\u5168&#xff08;\u53ef\u9009&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">echo &#034;source &lt;(kubectl completion bash)&#034; &gt;&gt; ~\/.bashrc<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">source ~\/.bashrc<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">5.6 \u52a0\u5165\u5176\u4f59 Master&#xff08;k8s-m2 \/ k8s-m3&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 k8s-m2\u3001k8s-m3 \u4e0a\u6267\u884c 5.4 \u8f93\u51fa\u4e2d\u5e26 &#8211;control-plane \u7684 join \u547d\u4ee4&#xff0c;\u4f8b\u5982&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm join 10.10.10.60:6443 &#8211;token &lt;token&gt; \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;discovery-token-ca-cert-hash sha256:&lt;hash&gt; \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;control-plane &#8211;certificate-key &lt;cert-key&gt;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u52a0\u5165\u5b8c\u6210\u540e&#xff0c;\u5728 k8s-m1 \u4e0a\u786e\u8ba4 3 \u4e2a Master \u5747\u5df2\u5c31\u7eea&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get nodes<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get pods -n kube-system -o wide<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">5.7 \u6709\u6548\u671f\u63d0\u9192\u4e0e\u8865\u6551<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">join \u547d\u4ee4\u4e2d\u7684\u4e24\u4e2a\u51ed\u636e\u6709\u6548\u671f\u4e0d\u540c&#xff0c;\u52a1\u5fc5\u6ce8\u610f&#xff1a;<\/span><\/span><\/p>\n<ul>\n<li><span style=\"color:#333333\">token&#xff1a;\u9ed8\u8ba4 24 \u5c0f\u65f6\u6709\u6548<\/span><\/li>\n<li><span style=\"color:#333333\">certificate-key&#xff1a;\u4ec5 2 \u5c0f\u65f6\u6709\u6548&#xff08;\u7528\u4e8e\u5176\u4ed6 Master \u4ee5 &#8211;control-plane \u65b9\u5f0f\u52a0\u5165&#xff0c;\u9700\u89e3\u5bc6\/\u4f20\u8f93\u63a7\u5236\u9762\u8bc1\u4e66&#xff09;<\/span><\/li>\n<\/ul>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u82e5\u8d85\u8fc7 2 \u5c0f\u65f6\u624d\u52a0\u5165\u5269\u4f59 Master&#xff0c;&#8211;certificate-key \u5df2\u5931\u6548&#xff0c;\u62a5\u9519\u5982 &#034;certificate key does not exist or is expired&#034;\u3002\u6b64\u65f6\u9700\u5728 k8s-m1 \u91cd\u65b0\u751f\u6210 certificate-key \u5e76\u7ee7\u7eed join&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm init phase upload-certs &#8211;upload-certs<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u91cd\u65b0\u751f\u6210 token&#xff08;\u5982\u9700\u65b0 join \u547d\u4ee4&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm token create &#8211;print-join-command<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">upload-certs \u4f1a\u8f93\u51fa\u4e00\u4e2a\u65b0\u7684 &#8211;certificate-key&#xff0c;\u7528\u5b83\u66ff\u6362 5.6 \u547d\u4ee4\u4e2d\u7684\u65e7 key \u5373\u53ef\u7ee7\u7eed\u52a0\u5165 Master\u3002<\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u516d\u7ae0 \u00a0\u90e8\u7f72 Calico \u7f51\u7edc\u63d2\u4ef6<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u63a7\u5236\u9762\u521d\u59cb\u5316\u5b8c\u6210\u540e&#xff0c;\u96c6\u7fa4\u5904\u4e8e NotReady \u72b6\u6001&#xff0c;\u9700\u90e8\u7f72 CNI \u7f51\u7edc\u63d2\u4ef6\u8ba9\u8282\u70b9\u5c31\u7eea\u3002\u672c\u65b9\u6848\u4f7f\u7528 Calico\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">6.1 \u83b7\u53d6\u5e76\u4fee\u6539 Calico \u6e05\u5355<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5fc5\u987b\u62c9\u53d6\u6307\u5b9a\u7a33\u5b9a\u7248\u672c\u6807\u7b7e&#xff0c;\u5207\u52ff\u4f7f\u7528 master \u5f00\u53d1\u5206\u652f&#xff08;master \u968f\u65f6\u662f\u672a\u53d1\u5e03\u6d4b\u8bd5\u7248\u672c&#xff0c;\u4e0d\u9002\u7528\u4e8e\u751f\u4ea7&#xff09;\u3002\u672c\u65b9\u6848\u7528\u5f53\u524d\u7a33\u5b9a\u7248 v3.32.2&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u5728 k8s-m1 \u4e0b\u8f7d\u6307\u5b9a\u7a33\u5b9a\u7248\u672c\u7684 Calico \u6e05\u5355<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">wget https:\/\/raw.githubusercontent.com\/projectcalico\/calico\/v3.32.2\/manifests\/calico.yaml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">grep -n &#034;10.244.0.0&#034; calico.yaml \u00a0\u00a0# \u786e\u8ba4 Pod \u7f51\u6bb5<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">grep -n &#034;CALICO_IPV4POOL_CIDR&#034; calico.yaml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u82e5\u6e05\u5355\u9ed8\u8ba4\u7f51\u6bb5\u4e0d\u662f 10.244.0.0\/16&#xff0c;\u7f16\u8f91\u8be5\u5904\u66ff\u6362\u4e3a 10.244.0.0\/16&#xff0c;\u4e0e kubeadm \u521d\u59cb\u5316\u65f6 podSubnet \u4fdd\u6301\u4e00\u81f4\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">MTU \u63d0\u793a&#xff1a;\u82e5\u865a\u62df\u673a\u7f51\u7edc\u4e3a NAT \u6a21\u5f0f&#xff0c;\u9ed8\u8ba4 MTU \u53ef\u80fd\u5bfc\u81f4 Pod \u95f4\u8bbf\u95ee\u5f02\u5e38&#xff08;\u90e8\u5206\u73af\u5883\u4e22\u5305\/\u8d85\u65f6&#xff09;\u3002\u6b64\u65f6\u9700\u8c03\u6574 Calico \u7684 MTU \u53c2\u6570&#xff0c;\u5c06\u5176\u8bbe\u7f6e\u4e3a\u4e3b\u673a\u7269\u7406\u7f51\u5361 MTU \u51cf\u53bb\u5c01\u88c5\u5f00\u9500&#xff08;VXLAN \u6a21\u5f0f\u51cf 50&#xff09;&#xff0c;\u4f8b\u5982\u4e3b\u673a MTU 1500 \u5219 Calico MTU \u8bbe\u4e3a 1450\u3002\u82e5 Pod \u901a\u4fe1\u5f02\u5e38&#xff0c;\u4f18\u5148\u68c0\u67e5\u6b64\u53c2\u6570\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">6.2 \u5e94\u7528 Calico<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl apply -f calico.yaml<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">6.3 \u786e\u8ba4\u8282\u70b9\u5c31\u7eea<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get nodes<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get pods -n kube-system<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b49\u5f85\u7247\u523b\u540e&#xff0c;\u6240\u6709\u8282\u70b9 STATUS \u53d8\u4e3a Ready&#xff0c;kube-system \u4e0b calico-node\u3001coredns \u7b49 Pod \u5904\u4e8e Running \u72b6\u6001\u5373\u90e8\u7f72\u6210\u529f\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5e38\u89c1\u95ee\u9898&#xff1a;\u82e5 coredns \u4e00\u76f4 Pending&#xff0c;\u901a\u5e38\u662f Calico \u7f51\u6bb5\u4e0e\u521d\u59cb\u5316\u4e0d\u4e00\u81f4&#xff0c;\u9700\u56de\u9000\u91cd\u65b0\u521d\u59cb\u5316&#xff1b;\u82e5 calico-node \u8d77\u4e0d\u6765&#xff0c;\u68c0\u67e5\u5185\u6838\u6a21\u5757\u4e0e IP \u8f6c\u53d1\u662f\u5426\u5df2\u5f00\u542f\u3002<\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u4e03\u7ae0 \u00a0\u52a0\u5165 Worker \u8282\u70b9<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 3 \u53f0 Worker \u8282\u70b9&#xff08;k8s-w1\u3001k8s-w2\u3001k8s-w3&#xff09;\u4e0a\u6267\u884c 5.4 \u8f93\u51fa\u4e2d\u666e\u901a\u7684 kubeadm join \u547d\u4ee4&#xff08;\u4e0d\u5e26 &#8211;control-plane&#xff09;&#xff0c;\u4f8b\u5982&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm join 10.10.10.60:6443 &#8211;token &lt;token&gt; \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;discovery-token-ca-cert-hash sha256:&lt;hash&gt;<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">7.1 \u91cd\u65b0\u751f\u6210 token&#xff08;\u82e5\u5df2\u8fc7\u671f&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">token \u9ed8\u8ba4 24 \u5c0f\u65f6\u6709\u6548\u3002\u82e5\u5df2\u8fc7\u671f&#xff0c;\u5728 k8s-m1 \u4e0a\u91cd\u65b0\u751f\u6210&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo kubeadm token create &#8211;print-join-command<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">7.2 \u9a8c\u8bc1\u96c6\u7fa4\u8282\u70b9<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u56de\u5230 k8s-m1 \u67e5\u770b\u6240\u6709\u8282\u70b9&#xff0c;\u671f\u671b 6 \u4e2a\u8282\u70b9&#xff08;3 Master &#043; 3 Worker&#xff09;\u5747\u4e3a Ready&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get nodes -o wide<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u67e5\u770b\u8282\u70b9\u89d2\u8272\u4e0e\u6807\u7b7e&#xff0c;\u786e\u8ba4 Master \u4e0e Worker \u5206\u5de5\u6b63\u786e&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get nodes &#8211;show-labels<\/span><\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u516b\u7ae0 \u00a0\u9a8c\u8bc1\u9ad8\u53ef\u7528\u4e0e\u6545\u969c\u6f14\u7ec3<\/span><\/span><\/h2>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">8.1 \u901a\u8fc7 VIP \u8bbf\u95ee API Server<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">curl -k https:\/\/10.10.10.60:6443\/version<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u6216\u4f7f\u7528 kubectl \u6307\u5b9a VIP&#xff08;\u751f\u4ea7\u73af\u5883\u914d\u597d\u8bc1\u4e66\u540e\u53ef\u76f4\u63a5\u7528&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl &#8211;server&#061;https:\/\/10.10.10.60:6443 get nodes<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">8.2 \u6d4b\u8bd5 API Server \u8d1f\u8f7d\u5747\u8861<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u591a\u6b21\u6267\u884c get nodes&#xff0c;\u89c2\u5bdf\u8bf7\u6c42\u88ab\u5206\u53d1\u5230\u4e0d\u540c Master&#xff08;\u53ef\u7ed3\u5408 haproxy \u65e5\u5fd7\u9a8c\u8bc1&#xff09;\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">8.3 \u6f14\u7ec3&#xff1a;Master \u6545\u969c\u8f6c\u79fb<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">**\u5b89\u5168\u63d0\u9192&#xff1a;etcd \u4e09\u526f\u672c\u4ec5\u80fd\u5bb9\u5fcd 1 \u53f0\u6545\u969c&#xff0c;\u6f14\u7ec3\u65f6\u7981\u6b62\u540c\u65f6\u5173\u95ed\u4e24\u53f0 Master \u8282\u70b9**&#xff0c;\u5426\u5219 etcd \u65e0\u6cd5\u5f62\u6210\u591a\u6570\u9009\u4e3e\u3001\u96c6\u7fa4\u5c06\u4e0d\u53ef\u7528\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 k8s-m1 \u4e0a\u6267\u884c\u5173\u673a&#xff0c;\u89c2\u5bdf\u96c6\u7fa4\u662f\u5426\u4ecd\u53ef\u7528&#xff08;\u5176\u4f59 Master \u63a5\u7ba1&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo shutdown now \u00a0\u00a0\u00a0\u00a0# \u6216 sudo reboot<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b49\u5f85 1-2 \u5206\u949f\u540e&#xff0c;\u5728\u4efb\u610f\u5b58\u6d3b Master \u4e0a\u6267\u884c&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get nodes<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u671f\u671b&#xff1a;\u96c6\u7fa4\u7ba1\u7406\u529f\u80fd\u4ecd\u6b63\u5e38&#xff0c;k8s-m1 \u663e\u793a NotReady&#xff1b;\u91cd\u542f\u540e\u81ea\u52a8\u6062\u590d\u4e3a Ready\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">8.4 \u6f14\u7ec3&#xff1a;LB \u6545\u969c\u8f6c\u79fb<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 lb01 \u4e0a\u505c\u6b62 keepalived \u6216\u76f4\u63a5\u5173\u673a&#xff0c;\u89c2\u5bdf VIP \u662f\u5426\u6f02\u79fb\u5230 lb02&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl stop keepalived \u00a0\u00a0# lb01 \u4e0a\u6267\u884c<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 lb02 \u4e0a\u6267\u884c\u786e\u8ba4 VIP \u5df2\u6f02\u79fb&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">ip addr show ens160 \u00a0\u00a0# \u671f\u671b\u770b\u5230 10.10.10.60<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">ping -c 2 10.10.10.60<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">8.5 \u90e8\u7f72\u6d4b\u8bd5\u5e94\u7528<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl create deployment nginx &#8211;image&#061;nginx &#8211;replicas&#061;3<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl expose deployment nginx &#8211;port&#061;80 &#8211;type&#061;NodePort<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get svc -o wide<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u901a\u8fc7\u4efb\u610f Worker \u8282\u70b9\u7684 NodePort \u8bbf\u95ee\u6d4b\u8bd5\u5e94\u7528&#xff0c;\u9a8c\u8bc1\u96c6\u7fa4\u4e1a\u52a1\u80fd\u529b\u6b63\u5e38\u3002<\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u4e5d\u7ae0 \u00a0\u96c6\u7fa4\u90e8\u7f72\u540e\u5de1\u68c0\u6e05\u5355<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u96c6\u7fa4\u642d\u5efa\u5b8c\u6210\u5e76\u9a8c\u8bc1\u9ad8\u53ef\u7528\u540e&#xff0c;\u5efa\u8bae\u6309\u4ee5\u4e0b\u6e05\u5355\u9010\u9879\u5de1\u68c0&#xff0c;\u786e\u4fdd\u751f\u4ea7\u5c31\u7eea&#xff1a;<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">9.1 \u96c6\u7fa4\u6574\u4f53\u72b6\u6001<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6ce8\u610f&#xff1a;kubectl get componentstatuses \u5728 Kubernetes 1.24 \u4e4b\u540e\u5df2\u5e9f\u5f03&#xff0c;\u4e0d\u518d\u8fd4\u56de\u6570\u636e&#xff0c;\u4e0d\u8981\u4f7f\u7528\u5b83\u6765\u68c0\u67e5\u63a7\u5236\u9762\u7ec4\u4ef6\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get nodes -o wide \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u6240\u6709\u8282\u70b9 Ready<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get pods -A \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u5168\u90e8 Running\/Completed&#xff0c;\u65e0 CrashLoop<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl top nodes \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u9700\u5b89\u88c5 metrics-server \u540e\u53ef\u7528<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">9.2 etcd \u5065\u5eb7\u68c0\u67e5&#xff08;\u751f\u4ea7\u5173\u952e&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">etcd \u662f\u96c6\u7fa4\u53ef\u7528\u6027\u7684\u6838\u5fc3&#xff0c;\u9700\u786e\u8ba4\u5065\u5eb7\u3001\u5bf9\u9f50\u72b6\u6001\u6b63\u5e38\u3002\u5728\u4efb\u4e00 Master \u4e0a\u6267\u884c&#xff08;kubeadm \u90e8\u7f72\u7684 etcd \u4e3a static pod&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># \u67e5\u770b etcd \u6210\u5458\u4e0e\u5065\u5eb7<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo crictl ps | grep etcd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo ETCDCTL_API&#061;3 etcdctl &#8211;cacert&#061;\/etc\/kubernetes\/pki\/etcd\/ca.crt \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;cert&#061;\/etc\/kubernetes\/pki\/etcd\/server.crt \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;key&#061;\/etc\/kubernetes\/pki\/etcd\/server.key \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0endpoint health &#8211;cluster<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo ETCDCTL_API&#061;3 etcdctl &#8211;cacert&#061;\/etc\/kubernetes\/pki\/etcd\/ca.crt \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;cert&#061;\/etc\/kubernetes\/pki\/etcd\/server.crt \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;key&#061;\/etc\/kubernetes\/pki\/etcd\/server.key \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0endpoint status -w table<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u671f\u671b\u6240\u6709 etcd \u6210\u5458 Raft \u72b6\u6001\u4e3a leader\/follower \u4e14 healthy&#061;true&#xff1b;\u82e5 leader \u6570\u4e0d\u4e3a 1 \u6216\u51fa\u73b0 alarm&#xff0c;\u9700\u53ca\u65f6\u6392\u67e5\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">9.3 etcd \u5b9a\u671f\u5907\u4efd&#xff08;\u751f\u4ea7\u5fc5\u5907&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u751f\u4ea7\u52a1\u5fc5\u914d\u7f6e etcd \u5b9a\u671f\u5feb\u7167\u5907\u4efd&#xff0c;\u4ee5\u9632\u6570\u636e\u4e22\u5931\u3002\u624b\u52a8\u5907\u4efd\u547d\u4ee4\u5982\u4e0b&#xff0c;\u5efa\u8bae\u901a\u8fc7 crontab \u5b9a\u65f6\u6267\u884c\u5e76\u5f02\u5730\u4fdd\u5b58\u5feb\u7167\u6587\u4ef6&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># \u624b\u52a8\u5feb\u7167\u5907\u4efd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo ETCDCTL_API&#061;3 etcdctl &#8211;cacert&#061;\/etc\/kubernetes\/pki\/etcd\/ca.crt \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;cert&#061;\/etc\/kubernetes\/pki\/etcd\/server.crt \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;key&#061;\/etc\/kubernetes\/pki\/etcd\/server.key \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0snapshot save \/backup\/etcd-snapshot-$(date &#043;%Y%m%d).db<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># \u9a8c\u8bc1\u5feb\u7167<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo ETCDCTL_API&#061;3 etcdctl snapshot status \/backup\/etcd-snapshot-*.db<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6062\u590d\u65f6\u4f7f\u7528 etcdctl snapshot restore \u6062\u590d\u5230\u4e34\u65f6\u76ee\u5f55\u540e\u66ff\u6362 etcd \u6570\u636e\u76ee\u5f55&#xff0c;\u751f\u4ea7\u5efa\u8bae\u5148\u6f14\u7ec3\u6062\u590d\u6d41\u7a0b\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">9.4 \u63a7\u5236\u9762\u7ec4\u4ef6\u72b6\u6001<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl -n kube-system get pod -l tier&#061;control-plane -o wide<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># \u786e\u8ba4 kube-apiserver \/ kube-controller-manager \/ kube-scheduler \u5747 Running<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">9.5 \u7f51\u7edc\u63d2\u4ef6\u4e0e CoreDNS<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl -n kube-system get pods -l k8s-app&#061;calico-node -o wide<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl -n kube-system get pods -l k8s-app&#061;kube-dns<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get svc -n kube-system kube-dns \u00a0\u00a0# \u786e\u8ba4 DNS \u670d\u52a1\u5b58\u5728<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">9.6 \u8d44\u6e90\u4e0e\u8282\u70b9\u5065\u5eb7<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl describe node &lt;\u8282\u70b9\u540d&gt; \u00a0\u00a0# \u67e5\u770b\u8d44\u6e90\u538b\u529b\u3001\u6c61\u70b9\u3001\u6761\u4ef6<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">df -h &amp;&amp; free -m \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u78c1\u76d8\u4e0e\u5185\u5b58\u6c34\u4f4d<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">systemctl status containerd kubelet \u00a0\u00a0# \u5173\u952e\u670d\u52a1\u72b6\u6001<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u4ee5\u4e0a\u5de1\u68c0\u9879\u5982\u5168\u90e8\u901a\u8fc7&#xff0c;\u96c6\u7fa4\u5373\u53ef\u89c6\u4e3a\u751f\u4ea7\u5c31\u7eea\u3002\u5efa\u8bae\u7eb3\u5165\u65e5\u5e38\u8fd0\u7ef4 SOP \u5b9a\u671f\u6267\u884c\u3002<\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7b2c\u5341\u7ae0 \u00a0\u90e8\u7f72 Harbor \u79c1\u6709\u955c\u50cf\u4ed3\u5e93<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u751f\u4ea7\u96c6\u7fa4\u901a\u5e38\u9700\u8981\u4e00\u4e2a\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u5b58\u653e\u4e1a\u52a1\u955c\u50cf&#xff0c;Harbor \u662f\u4e1a\u754c\u6807\u51c6\u9009\u62e9\u3002\u672c\u65b9\u6848\u5728\u72ec\u7acb\u8282\u70b9 harbor&#xff08;10.10.10.58&#xff09;\u4e0a\u90e8\u7f72&#xff0c;\u914d\u7f6e\u81ea\u7b7e HTTPS \u8bc1\u4e66&#xff0c;\u5e76\u8ba9\u96c6\u7fa4\u5404\u8282\u70b9\u4fe1\u4efb\u8be5 CA&#xff0c;\u901a\u8fc7 regcred \u5b9e\u73b0\u955c\u50cf\u62c9\u53d6\u8ba4\u8bc1\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.1 \u67b6\u6784\u6f84\u6e05&#xff1a;Harbor \u4e0e\u96c6\u7fa4\u8ba4\u8bc1\u7684\u5173\u7cfb<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6ce8\u610f\u533a\u5206\u4e09\u7c7b\u8ba4\u8bc1&#xff1a;\u96c6\u7fa4\u5185\u90e8\u7ec4\u4ef6\u95f4&#xff08;API Server \/ kubelet \/ etcd&#xff09;\u7684 TLS \u53cc\u5411\u8ba4\u8bc1\u7531 kubeadm \u81ea\u5e26\u7684 PKI \u4f53\u7cfb\u7ba1\u7406&#xff0c;\u4e0e Harbor \u65e0\u5173&#xff1b;Harbor \u53ea\u8d1f\u8d23\u300c\u8282\u70b9\u8bbf\u95ee\u4ed3\u5e93\u65f6\u6821\u9a8c\u5176 HTTPS \u8bc1\u4e66\u300d\u4ee5\u53ca\u300ckubelet \u62c9\u79c1\u6709\u955c\u50cf\u65f6\u7684\u8d26\u53f7\u8ba4\u8bc1\u300d\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.2 \u5b89\u88c5 Docker&#xff08;harbor \u8282\u70b9&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">Harbor \u4f9d\u8d56 Docker \u4e0e Docker Compose\u3002Rocky 9 \u4f7f\u7528 docker-ce \u5b98\u65b9\u6e90\u5b89\u88c5&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y yum-utils<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf config-manager &#8211;add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl enable &#8211;now docker<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo docker version<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.3 \u51c6\u5907\u81ea\u7b7e HTTPS \u8bc1\u4e66<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u751f\u4ea7\u73af\u5883 Harbor \u5fc5\u987b\u8d70 HTTPS\u3002\u4e3a\u7b80\u5316&#xff0c;\u4f7f\u7528\u81ea\u7b7e CA \u5e76\u4e3a harbor \u57df\u540d\/IP \u7b7e\u53d1\u8bc1\u4e66&#xff08;\u542b\u4e3b\u673a\u540d\u4e0e IP SAN&#xff09;&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">mkdir -p \/opt\/harbor\/{ssl,data}<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">cd \/opt\/harbor\/ssl<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u751f\u6210 CA \u79c1\u94a5\u4e0e\u81ea\u7b7e\u6839\u8bc1\u4e66<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">openssl genrsa -out ca.key 4096<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0-subj &#034;\/CN&#061;Harbor CA&#034; -out ca.crt<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u751f\u6210 harbor \u79c1\u94a5<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">openssl genrsa -out harbor.key 2048<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u751f\u6210\u5e26 SAN&#xff08;\u542b\u57df\u540d &#043; IP&#xff09;\u7684\u8bc1\u4e66\u7b7e\u540d\u8bf7\u6c42\u3002\u6ce8\u610f SAN \u5fc5\u987b\u653e\u5728 req_extensions&#xff08;req_ext \u6bb5&#xff09;\u800c\u975e [SAN] \u6bb5&#xff0c;\u5426\u5219 openssl req \u9636\u6bb5\u4e0d\u4f1a\u8bfb\u53d6&#xff0c;\u751f\u6210\u7684\u8bc1\u4e66\u5c06\u4e0d\u542b IP SAN&#xff0c;\u6d4f\u89c8\u5668 \/ containerd \u8bbf\u95ee\u4f1a\u62a5\u8bc1\u4e66 IP \u4e0d\u5339\u914d&#xff0c;\u5bfc\u81f4\u955c\u50cf\u62c9\u53d6\u5931\u8d25\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u6b63\u786e\u5199\u6cd5&#xff1a;subjectAltName \u5b9a\u4e49\u5728 req_ext \u6bb5&#xff0c;\u7b7e\u53d1\u65f6\u7528 -extensions req_ext<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">cat &gt; harbor.cnf &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">[req]<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">distinguished_name&#061;dn<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">prompt&#061;no<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">[req_ext]<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">subjectAltName&#061;&#064;alt_names<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">[alt_names]<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">DNS.1 &#061; harbor<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">IP.1 &#061; 10.10.10.58<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">[dn]<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">CN &#061; harbor<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">openssl req -new -key harbor.key -out harbor.csr -config harbor.cnf<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">openssl x509 -req -in harbor.csr -CA ca.crt -CAkey ca.key \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0-CAcreateserial -out harbor.crt -days 3650 \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0-sha256 -extensions req_ext -extfile harbor.cnf<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7b7e\u53d1\u540e\u52a1\u5fc5\u7528 openssl \u6821\u9a8c\u8bc1\u4e66\u786e\u5b9e\u5305\u542b IP SAN&#xff0c;\u5426\u5219\u540e\u7eed\u8bbf\u95ee\u5fc5\u62a5\u9519&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">openssl x509 -in harbor.crt -noout -text | grep -A1 &#034;Subject Alternative Name&#034;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u671f\u671b\u8f93\u51fa: DNS:harbor, IP Address:10.10.10.58<\/span><\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.4 \u4e0b\u8f7d\u5e76\u914d\u7f6e Harbor<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">cd \/opt\/harbor<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">wget https:\/\/github.com\/goharbor\/harbor\/releases\/download\/v2.11.1\/harbor-offline-installer-v2.11.1.tgz<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">tar -xzf harbor-offline-installer-*.tgz<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">cd harbor<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">cp harbor.yml.tmpl harbor.yml<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7f16\u8f91 harbor.yml\u3002\u6700\u4f73\u5b9e\u8df5\u5efa\u8bae\u4f7f\u7528\u57df\u540d\u4f5c\u4e3a hostname&#xff08;\u800c\u975e IP&#xff09;&#xff0c;\u8bc1\u4e66 SAN \u4e2d\u9700\u5305\u542b\u5bf9\u5e94\u57df\u540d&#xff1b;\u96c6\u7fa4\u5404\u8282\u70b9 hosts \u5df2\u914d\u7f6e harbor \u57df\u540d\u89e3\u6790&#xff08;\u89c1\u7b2c\u4e8c\u7ae0&#xff09;\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">hostname: harbor \u00a0\u00a0\u00a0\u00a0# \u5efa\u8bae\u7528\u57df\u540d&#xff1b;hosts \u5df2\u6620\u5c04 harbor \u2192 10.10.10.58<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">http: \u00a0port: 80<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">https: \u00a0port: 443<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0certificate: \/opt\/harbor\/ssl\/harbor.crt<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0private_key: \/opt\/harbor\/ssl\/harbor.key<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">harbor_admin_password: HarborAdmin&#064;123<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6ce8\u610f&#xff1a;harbor_admin_password \u4ee5\u660e\u6587\u5199\u5165 harbor.yml&#xff0c;\u5b89\u88c5\u540e\u52a1\u5fc5\u5230 Web \u754c\u9762\u5c3d\u5feb\u4fee\u6539\u9ed8\u8ba4\u7ba1\u7406\u5458\u5bc6\u7801&#xff0c;\u907f\u514d\u5f31\u53e3\u4ee4\u98ce\u9669\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.5 \u6267\u884c\u5b89\u88c5<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo .\/prepare<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo .\/install.sh<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo docker compose ps<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u6d4f\u89c8\u5668\u8bbf\u95ee https:\/\/harbor&#xff08;\u6216 https:\/\/10.10.10.58&#xff09;\u767b\u5f55&#xff08;\u9ed8\u8ba4\u8d26\u53f7 admin \/ \u4e0a\u8ff0\u5bc6\u7801&#xff0c;\u8bf7\u5c3d\u5feb\u4fee\u6539&#xff09;\u3002\u5efa\u8bae\u5148\u521b\u5efa\u4e00\u4e2a\u7528\u4e8e\u62c9\u53d6\u955c\u50cf\u7684\u666e\u901a\u8d26\u53f7&#xff0c;\u4f8b\u5982 k8s \u7528\u6237\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.6 \u65f6\u95f4\u540c\u6b65\u6821\u9a8c&#xff08;\u8bc1\u4e66\u4f9d\u8d56&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">HTTPS \u8bc1\u4e66\u6821\u9a8c\u5f3a\u4f9d\u8d56\u8282\u70b9\u65f6\u95f4&#xff0c;Harbor \u8282\u70b9\u4e0e K8s \u8282\u70b9\u65f6\u95f4\u5fc5\u987b\u4e00\u81f4&#xff0c;\u5426\u5219\u4f1a\u51fa\u73b0\u8bc1\u4e66\u9a8c\u8bc1\u5931\u8d25\u3002\u6267\u884c\u524d\u5148\u6821\u9a8c Harbor \u8282\u70b9\u65f6\u95f4\u540c\u6b65\u662f\u5426\u6b63\u5e38&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">chronyc tracking \u00a0\u00a0# \u67e5\u770b\u7cfb\u7edf\u65f6\u949f\u540c\u6b65\u72b6\u6001<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">chronyc sources -v # \u786e\u8ba4\u5df2\u8fde\u63a5\u65f6\u95f4\u6e90<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">timedatectl \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# \u786e\u8ba4 NTP synchronized: yes<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u82e5 timedatectl \u663e\u793a NTP synchronized: no&#xff0c;\u8bf4\u660e chrony \u672a\u6b63\u5e38\u540c\u6b65&#xff0c;\u9700\u4fee\u590d\u540e\u518d\u7ee7\u7eed&#xff0c;\u5426\u5219\u8bc1\u4e66\u6821\u9a8c\u4f1a\u56e0\u65f6\u95f4\u504f\u79fb\u5931\u8d25\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.7 \u96c6\u7fa4\u8282\u70b9\u4fe1\u4efb Harbor CA&#xff08;6 \u53f0\u8282\u70b9\u5168\u90e8\u914d\u7f6e&#xff09;<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">K8s \u8282\u70b9\u4f7f\u7528 containerd \u4f5c\u4e3a\u8fd0\u884c\u65f6&#xff0c;\u53ea\u4f1a\u8bfb\u53d6 \/etc\/containerd\/certs.d \u76ee\u5f55&#xff0c;\u4e0d\u4f1a\u8bfb\u53d6 Docker \u7684 \/etc\/docker\/certs.d\u3002\u56e0\u6b64**\u53ea\u9700\u914d\u7f6e containerd \u76ee\u5f55**&#xff0c;\u5207\u52ff\u6df7\u6dc6\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u6b64\u64cd\u4f5c\u5fc5\u987b\u5728**\u5168\u90e8 6 \u53f0 K8s \u8282\u70b9**&#xff08;3 Master &#043; 3 Worker&#xff09;\u4e0a\u6267\u884c&#xff0c;\u4ec5\u5728 m1 \u914d\u7f6e\u4f1a\u5bfc\u81f4\u5176\u4ed6\u8282\u70b9\u62c9\u53d6\u955c\u50cf\u62a5\u9519\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u524d\u63d0&#xff1a;\u4ee5\u4e0b\u7528 scp \u5206\u53d1\u7684 for \u5faa\u73af\u4f9d\u8d56**\u5df2\u914d\u7f6e SSH \u514d\u5bc6\u767b\u5f55**&#xff08;harbor \u8282\u70b9\u5230\u5404\u8282\u70b9&#xff09;\u3002\u82e5\u672a\u914d\u7f6e\u514d\u5bc6&#xff0c;scp \u4f1a\u9010\u53f0\u5361\u5728\u5bc6\u7801\u8f93\u5165\u5904&#xff08;scp \u65e0\u6cd5\u4ea4\u4e92\u5f0f\u6279\u91cf\u8f93\u5bc6\u7801&#xff09;\u3002\u672a\u914d\u514d\u5bc6\u65f6&#xff0c;\u8bf7\u6539\u7528\u9010\u53f0\u624b\u52a8 scp &#043; \u8f93\u5bc6\u7801&#xff0c;\u6216\u5148\u5b8c\u6210 ssh-copy-id\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># &#xff08;\u53ef\u9009&#xff09;\u5148\u5728 harbor \u8282\u70b9\u914d\u7f6e\u5230\u5404\u8282\u70b9\u7684\u514d\u5bc6\u767b\u5f55<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">for n in k8s-m1 k8s-m2 k8s-m3 k8s-w1 k8s-w2 k8s-w3; do<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0ssh-copy-id $n \u00a0\u00a0# \u9996\u6b21\u9700\u624b\u52a8\u8f93\u4e00\u6b21\u5bc6\u7801<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">done<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u514d\u5bc6\u5c31\u7eea\u540e&#xff0c;\u5728 harbor \u8282\u70b9\u628a CA \u62f7\u5230\u5404\u8282\u70b9<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">for n in k8s-m1 k8s-m2 k8s-m3 k8s-w1 k8s-w2 k8s-w3; do<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0scp \/opt\/harbor\/ssl\/ca.crt $n:\/tmp\/harbor-ca.crt<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">done<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#6a737d\"># \u5728\u5404\u8282\u70b9\u6267\u884c&#xff1a;\u4ec5\u914d containerd \u7684 certs.d<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo mkdir -p \/etc\/containerd\/certs.d\/harbor<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo mv \/tmp\/harbor-ca.crt \/etc\/containerd\/certs.d\/harbor\/ca.crt<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo tee \/etc\/containerd\/certs.d\/harbor\/hosts.toml &lt;&lt;EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">server &#061; &#034;https:\/\/harbor&#034;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">[host.&#034;https:\/\/harbor&#034;]<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0ca &#061; &#034;\/etc\/containerd\/certs.d\/harbor\/ca.crt&#034;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0skip_verify &#061; false<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">EOF<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo systemctl restart containerd<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u8bf4\u660e&#xff1a;\u76ee\u5f55\u540d\u4e0e hosts.toml \u7684 server \u9700\u4e0e\u955c\u50cf\u4ed3\u5e93\u5730\u5740\u4e00\u81f4&#xff08;\u6b64\u5904\u7528\u57df\u540d harbor&#xff09;\u3002skip_verify &#061; false \u663e\u5f0f\u8981\u6c42\u6821\u9a8c\u8bc1\u4e66&#xff0c;\u9632\u6b62\u8bef\u914d\u5bfc\u81f4\u8df3\u8fc7\u6821\u9a8c\u5e26\u6765\u5b89\u5168\u98ce\u9669\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.8 \u521b\u5efa regcred \u62c9\u53d6\u51ed\u8bc1<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u5728 Harbor \u521b\u5efa\u597d\u9879\u76ee&#xff08;\u5982 project01&#xff09;\u5e76\u6388\u6743 k8s \u8d26\u53f7\u540e&#xff0c;\u5728 K8s \u96c6\u7fa4\u521b\u5efa\u955c\u50cf\u62c9\u53d6 Secret \u5e76\u7ed1\u5b9a\u9ed8\u8ba4 ServiceAccount&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl create secret docker-registry regcred \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;docker-server&#061;harbor \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;docker-username&#061;k8s &#8211;docker-password&#061;&lt;\u5bc6\u7801&gt; \\\\<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u00a0\u00a0&#8211;docker-email&#061;admin&#064;example.com<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl patch serviceaccount default -p &#039;{&#034;imagePullSecrets&#034;:[{&#034;name&#034;:&#034;regcred&#034;}]}&#039;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u98ce\u9669\u63d0\u793a&#xff1a;patch \u9ed8\u8ba4 ServiceAccount \u4f1a\u8ba9\u96c6\u7fa4\u5185\u6240\u6709 Pod \u9ed8\u8ba4\u643a\u5e26\u8be5\u62c9\u53d6\u51ed\u8bc1\u3002\u82e5\u540e\u7eed\u63a5\u5165\u591a\u4e2a\u79c1\u6709\u4ed3\u5e93&#xff0c;\u6b64\u5168\u5c40\u6ce8\u5165\u4f1a\u6709\u526f\u4f5c\u7528&#xff08;\u4e0d\u540c\u4ed3\u5e93\u9700\u4e0d\u540c\u51ed\u8bc1\u65f6\u65e0\u6cd5\u533a\u5206&#xff09;&#xff0c;\u5efa\u8bae\u4ec5\u5728\u9700\u8981\u79c1\u6709\u955c\u50cf\u7684\u547d\u540d\u7a7a\u95f4\u6216\u5de5\u4f5c\u8d1f\u8f7d\u4e0a\u663e\u5f0f\u6307\u5b9a imagePullSecrets\u3002<\/span><\/span><\/p>\n<h3><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">10.9 \u9a8c\u8bc1\u4ece Harbor \u62c9\u53d6\u955c\u50cf<\/span><\/span><\/h3>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u7528 Harbor \u63a8\u9001\u4e00\u4e2a\u6d4b\u8bd5\u955c\u50cf\u5e76\u9a8c\u8bc1\u96c6\u7fa4\u53ef\u62c9\u53d6\u3002\u4ee5\u4e0b\u5728 Harbor \u8282\u70b9\u672c\u673a\u7528 IP \u64cd\u4f5c&#xff08;SAN \u5df2\u542b IP&#xff0c;\u6700\u7701\u4e8b&#xff09;&#xff1b;\u96c6\u7fa4\u5185\u5219\u7edf\u4e00\u7528\u57df\u540d harbor \u62c9\u53d6&#xff0c;\u4e0e 10.7 \u914d\u7f6e\u4e00\u81f4&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># Harbor \u8282\u70b9\u672c\u673a&#xff1a;\u767b\u5f55\u5e76\u63a8\u9001<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo docker login 10.10.10.58 -u k8s -p &lt;\u5bc6\u7801&gt;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo docker tag nginx:latest 10.10.10.58\/project01\/nginx:v1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">sudo docker push 10.10.10.58\/project01\/nginx:v1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\"># \u96c6\u7fa4\u5185\u521b\u5efa Pod \u9a8c\u8bc1&#xff08;\u7528\u57df\u540d harbor&#xff09;<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl create deployment myapp &#8211;image&#061;harbor\/project01\/nginx:v1<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"background-color:#f6f8fa\"><span style=\"color:#333333\"><span style=\"color:#333333\">kubectl get pods<\/span><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u82e5 Pod \u80fd\u6210\u529f Running&#xff0c;\u8bf4\u660e Harbor \u4ed3\u5e93\u3001HTTPS \u4fe1\u4efb\u4e0e regcred \u8ba4\u8bc1\u5168\u90e8\u6253\u901a\u3002<\/span><\/span><\/p>\n<h2><span style=\"color:#1f4e79\"><span style=\"color:#1f4e79\">\u7ed3\u8bed<\/span><\/span><\/h2>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u81f3\u6b64&#xff0c;\u4e00\u5957\u57fa\u4e8e Rocky Linux 9 \u7684\u6807\u51c6\u751f\u4ea7\u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u5b8c\u6210&#xff1a;3 \u53f0 Master&#xff08;\u5185\u7f6e etcd&#xff09;\u63d0\u4f9b\u63a7\u5236\u9762\u9ad8\u53ef\u7528&#xff0c;2 \u53f0 LB&#xff08;Keepalived &#043; HAProxy&#xff09;\u4fdd\u8bc1 API \u5165\u53e3\u9ad8\u53ef\u7528&#xff0c;3 \u53f0 Worker \u627f\u8f7d\u4e1a\u52a1&#xff0c;\u72ec\u7acb harbor \u8282\u70b9\u63d0\u4f9b\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u3002\u4efb\u4e00\u53f0\u63a7\u5236\u9762\u3001\u8d1f\u8f7d\u5747\u8861\u6216\u4ed3\u5e93\u8282\u70b9\u6545\u969c\u90fd\u4e0d\u5f71\u54cd\u96c6\u7fa4\u6574\u4f53\u53ef\u7528\u6027\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\"><span style=\"color:#333333\"><span style=\"color:#333333\">\u540e\u7eed\u53ef\u5728\u6b64\u57fa\u7840\u4e0a\u6269\u5c55&#xff1a;\u90e8\u7f72 Rancher\/K8s Dashboard \u53ef\u89c6\u5316\u3001\u914d\u7f6e Metrics Server \u4e0e HPA\u3001\u542f\u7528 NetworkPolicy \u4e0e\u5ba1\u8ba1\u65e5\u5fd7\u7b49\u5b89\u5168\u52a0\u56fa&#xff0c;\u6216\u4e3a Harbor \u914d\u7f6e Trivy \u955c\u50cf\u6f0f\u6d1e\u626b\u63cf\u3002<\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6807\u51c6\u751f\u4ea7\u67b6\u6784&#xff1a;3 Master  3 Worker  2 LB  Harbor \u57fa\u4e8e VMware Workstation \u514b\u9686\u673a Kubernetes v1.36 \u00a0\u00b7 \u00a0containerd \u00a0\u00b7 \u00a0Calico \u00a0\u00b7 \u00a0Keepalived  HAProxy \u00a0\u00b7 \u00a0Harbor Tommypeng 2026-09-12 \u76ee \u00a0\u5f55 \u7b2c\u4e00\u7ae0 \u00a0\u67b6\u6784\u8bbe\u8ba1\u4e0e\u89c4\u5212 1.1 \u603b\u4f53\u67b6\u6784 1.2 \u8282\u70b9\u6e05\u5355\u4e0e IP \u89c4\u5212 1.3 \u7248\u672c\u9009\u578b 1.4 \u8d44\u6e90\u5206\u914d\u5efa\u8bae 1.5 \u7aef<\/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":[120,58,44],"topic":[],"class_list":["post-107774","post","type-post","status-publish","format-standard","hentry","category-server","tag-kubernetes","tag-linux","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c - \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\/107774.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6807\u51c6\u751f\u4ea7\u67b6\u6784&#xff1a;3 Master 3 Worker 2 LB Harbor \u57fa\u4e8e VMware Workstation \u514b\u9686\u673a Kubernetes v1.36 \u00a0\u00b7 \u00a0containerd \u00a0\u00b7 \u00a0Calico \u00a0\u00b7 \u00a0Keepalived HAProxy \u00a0\u00b7 \u00a0Harbor Tommypeng 2026-09-12 \u76ee \u00a0\u5f55 \u7b2c\u4e00\u7ae0 \u00a0\u67b6\u6784\u8bbe\u8ba1\u4e0e\u89c4\u5212 1.1 \u603b\u4f53\u67b6\u6784 1.2 \u8282\u70b9\u6e05\u5355\u4e0e IP \u89c4\u5212 1.3 \u7248\u672c\u9009\u578b 1.4 \u8d44\u6e90\u5206\u914d\u5efa\u8bae 1.5 \u7aef\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/107774.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-20T02:16:36+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=\"17 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/107774.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/107774.html\",\"name\":\"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-20T02:16:36+00:00\",\"dateModified\":\"2026-09-20T02:16:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/107774.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/107774.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/107774.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c\"}]},{\"@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":"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c - \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\/107774.html","og_locale":"zh_CN","og_type":"article","og_title":"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6807\u51c6\u751f\u4ea7\u67b6\u6784&#xff1a;3 Master 3 Worker 2 LB Harbor \u57fa\u4e8e VMware Workstation \u514b\u9686\u673a Kubernetes v1.36 \u00a0\u00b7 \u00a0containerd \u00a0\u00b7 \u00a0Calico \u00a0\u00b7 \u00a0Keepalived HAProxy \u00a0\u00b7 \u00a0Harbor Tommypeng 2026-09-12 \u76ee \u00a0\u5f55 \u7b2c\u4e00\u7ae0 \u00a0\u67b6\u6784\u8bbe\u8ba1\u4e0e\u89c4\u5212 1.1 \u603b\u4f53\u67b6\u6784 1.2 \u8282\u70b9\u6e05\u5355\u4e0e IP \u89c4\u5212 1.3 \u7248\u672c\u9009\u578b 1.4 \u8d44\u6e90\u5206\u914d\u5efa\u8bae 1.5 \u7aef","og_url":"https:\/\/www.wsisp.com\/helps\/107774.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-20T02:16:36+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"17 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/107774.html","url":"https:\/\/www.wsisp.com\/helps\/107774.html","name":"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-20T02:16:36+00:00","dateModified":"2026-09-20T02:16:36+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/107774.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/107774.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/107774.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Rocky Linux 9 \u9ad8\u53ef\u7528 Kubernetes \u96c6\u7fa4\u90e8\u7f72\u624b\u518c"}]},{"@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\/107774","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=107774"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/107774\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=107774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=107774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=107774"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=107774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}