{"id":5120,"date":"2021-10-12T10:51:34","date_gmt":"2021-10-12T02:51:34","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=5120"},"modified":"2021-10-12T10:51:35","modified_gmt":"2021-10-12T02:51:35","slug":"k8s-6","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2021\/10\/12\/k8s-6\/","title":{"rendered":"k8s\u96c6\u7fa4\u7ba1\u7406"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e00\u3001Node\u7ba1\u7406\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3001 Node\u7684\u9694\u79bb\u4e0e\u6062\u590d\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u786c\u4ef6\u5347\u7ea7\u3001\u786c\u4ef6\u7ef4\u62a4\u7b49\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u5c06\u67d0\u4e9bNode\u9694\u79bb\uff0c\u4f7f\u5176 \u8131\u79bbKubernetes\u96c6\u7fa4\u7684\u8c03\u5ea6\u8303\u56f4\u3002Kubernetes\u63d0\u4f9b\u4e86\u4e00\u79cd\u673a\u5236\uff0c\u65e2\u53ef\u4ee5\u5c06 Node\u7eb3\u5165\u8c03\u5ea6\u8303\u56f4\uff0c\u4e5f\u53ef\u4ee5\u5c06Node\u8131\u79bb\u8c03\u5ea6\u8303\u56f4\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f7f\u7528kubectl\u7684\u5b50\u547d\u4ee4cordon\u548cuncordon\u53ef\u4ee5\u5b9e\u73b0\u5c06Node\u8fdb\u884c\u9694\u79bb\u8c03\u5ea6\u548c\u6062\u590d\u8c03\u5ea6\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a\u901a\u8fc7\u547d\u4ee4\u5c06k8s-node1\u8fdb\u884c\u9694\u79bb\uff0c\u7136\u540e\u67e5\u770b\u72b6\u6001\u53ef\u4ee5\u770b\u5230\u663e\u793a\u4e3aSchedulingDisabled\uff0c\u5982\u56fe\uff1a <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"597\" height=\"180\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/39-1.png\" alt=\"\" class=\"wp-image-5121\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/39-1.png 597w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/39-1-300x90.png 300w\" sizes=\"auto, (max-width: 597px) 100vw, 597px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u518d\u6b21\u901a\u8fc7\u547d\u4ee4kubectl uncordon\u5c06\u8282\u70b9\u6062\u590d\u56de\u53ef\u8c03\u5ea6\u8303\u56f4\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"180\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/40-1.png\" alt=\"\" class=\"wp-image-5123\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/40-1.png 580w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/40-1-300x93.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/figure>\n\n\n\n<p class=\"has-background has-luminous-vivid-amber-background-color wp-block-paragraph\">\u6ce8\u610f\uff1a \u5c06\u67d0\u4e2aNode\u8131\u79bb\u8c03\u5ea6\u8303\u56f4\u65f6\uff0c\u5728\u5176\u4e0a\u8fd0\u884c\u7684Pod\u5e76\u4e0d\u4f1a\u81ea\u52a8\u505c\u6b62\uff0c\u7ba1\u7406\u5458\u9700\u8981\u624b\u52a8\u505c\u6b62\u5728\u8be5Node\u4e0a\u8fd0\u884c\u7684Pod <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\u3001node\u6269\u5bb9\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7kubeadm\u90e8\u7f72\u4e86k8s\u96c6\u7fa4\u540e\uff0c\u5982\u679c\u8981\u65b0\u589eNode\u8282\u70b9\uff0c\u5e94\u8be5\u505a\u5982\u4e0b\u57fa\u7840\u5de5\u4f5c\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u7cfb\u7edf\u5185\u6838\u521d\u59cb\u5316\u8bbe\u7f6e<\/li><li>docker\u5b89\u88c5<\/li><li>\u5b89\u88c5kubeadm\u3001kubelet\u7b49\u7ec4\u4ef6<\/li><li>\u4fee\u6539\u8282\u70b9\u4e3b\u673a\u540d\u4e3ak8s-node3(\u4e3e\u4f8b)<\/li><li>\u4fee\u6539\u6240\u6709\u673a\u5668\u7684\/etc\/hosts\uff0c\u5c06\u65b0\u8282\u70b9\u52a0\u5165\u5230\u914d\u7f6e\u4e2d<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728master\u8282\u70b9\u521b\u5efatoken\u548chash\u503c\uff0c\u7136\u540e\u901a\u8fc7<strong>kubeadm join<\/strong>\u52a0\u5165\u5230\u96c6\u7fa4\u5373\u53ef<\/p>\n\n\n\n<p class=\"has-background has-luminous-vivid-amber-background-color wp-block-paragraph\">\u6ce8\u610f\uff1a\u53ef\u80fd\u9700\u8981\u624b\u52a8\u62c9\u53d6pause\u955c\u50cf\u548ckube-proxy\u955c\u50cf\uff0ccalico\u955c\u50cf\u4f1a\u81ea\u52a8\u62c9\u53d6\u4e0b\u6765<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3\u3001\u5220\u9664node\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> \u9996\u5148\u5728&nbsp;<strong>master&nbsp;<\/strong>\u8282\u70b9\u4e0a\u4f9d\u6b21\u6267\u884c\u4ee5\u4e0b\u4e24\u4e2a\u547d\u4ee4\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u6392\u9664\u6b64\u8282\u70b9\uff0c\u5c06\u4e0a\u9762\u7684pod\u6e05\u9664\uff0c\u91cd\u65b0\u8c03\u5ea6\u5230\u522b\u7684\u8282\u70b9\u4e0a\nkubectl drain k8s-node1 --delete-local-data --force --ignore-daemonsets\n#\u5220\u9664\u8282\u70b9\nkubectl delete node  k8s-node1\n\n\u6267\u884c\u540e\u901a\u8fc7 kubectl get node \u547d\u4ee4\u53ef\u4ee5\u770b\u5230 k8s-node1 \u5df2\u88ab\u6210\u529f\u5220\u9664\uff1a<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u7740\u5728&nbsp;<strong>k8s-node1&nbsp;<\/strong>\u8fd9\u4e2a&nbsp;<strong>Node&nbsp;<\/strong>\u8282\u70b9\u4e0a\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff0c\u8fd9\u6837\u8be5\u8282\u70b9\u5373\u5b8c\u5168\u4ece&nbsp;<strong>Cluster&nbsp;<\/strong>\u4e2d\u8131\u79bb\u5f00\u6765\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u91cd\u7f6e\u8282\u70b9\nkubeadm reset<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001Node\u7ba1\u7406\uff1a 1\u3001 Node\u7684\u9694\u79bb\u4e0e\u6062\u590d\uff1a \u5728\u786c\u4ef6\u5347\u7ea7\u3001\u786c\u4ef6\u7ef4\u62a4\u7b49\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u5c06\u67d0\u4e9bNode\u9694\u79bb\uff0c\u4f7f [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5176,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,23],"tags":[],"class_list":["post-5120","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kubernetes","category-rong"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=5120"}],"version-history":[{"count":7,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5120\/revisions"}],"predecessor-version":[{"id":5177,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5120\/revisions\/5177"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/5176"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=5120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=5120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=5120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}