{"id":1043,"date":"2018-10-10T16:01:04","date_gmt":"2018-10-10T08:01:04","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=1043"},"modified":"2018-10-10T16:01:04","modified_gmt":"2018-10-10T08:01:04","slug":"kubernetes-centos7%e5%ae%89%e8%a3%85kubernetes1-11-2%e5%9b%be%e6%96%87%e5%ae%8c%e6%95%b4%e7%89%88","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=1043","title":{"rendered":"kubernetes&#8212;CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248"},"content":{"rendered":"<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904:<a title=\"kubernetes---CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248\" href=\"http:\/\/www.525.life\/article?id=1510739742331\" target=\"_blank\" rel=\"nofollow noopener\">kubernetes\u2014CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248<\/a><\/p>\n<h1 id=\"\u67b6\u6784\u89c4\u5212\"><a name=\"t0\"><\/a>\u67b6\u6784\u89c4\u5212<\/h1>\n<p>k8s\u81f3\u5c11\u9700\u8981\u4e00\u4e2amaster\u548c\u4e00\u4e2anode\u624d\u80fd\u7ec4\u6210\u4e00\u4e2a\u53ef\u7528\u96c6\u7fa4\u3002<\/p>\n<p>\u672c\u7ae0\u6211\u4eec\u642d\u5efa\u4e00\u4e2amaster\u8282\u70b9\u548c\u4e09\u4e2anode\u8282\u70b9\u3002<br \/>\n\u6211\u4eec\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u65f6k8s\u65f6\u53ef\u4ee5\u9002\u5f53\u589e\u52a0\u8282\u70b9\u3002<\/p>\n<p>\u6211\u4eec\u6709\u4e09\u53f0\u670d\u52a1\u5668\uff0cip\u548c\u8eab\u4efd\u89c4\u5212\u5982\u4e0b:<br \/>\n192.168.11.90 master node<br \/>\n192.168.11.91 node<br \/>\n192.168.11.92 node<\/p>\n<p>192.168.11.90\u5373\u4f5cmaster\u8282\u70b9\u53c8\u4f5cnode\u8282\u70b9\u3002<\/p>\n<p>\u4e09\u53f0\u670d\u52a1\u5668\u90fd\u662fCentOS7\u7cfb\u7edf\u3002<\/p>\n<p>\u6ce8\u610f\uff1aKubernetes \u51e0\u4e4e\u6240\u6709\u7684\u5b89\u88c5\u7ec4\u4ef6\u548c Docker \u955c\u50cf\u90fd\u653e\u5728 goolge \u81ea\u5df1\u7684\u7f51\u7ad9\u4e0a\uff0c\u8fd9\u5bf9\u56fd\u5185\u7684\u540c\u5b66\u53ef\u80fd\u662f\u4e2a\u4e0d\u5c0f\u7684\u969c\u788d\u3002\u5efa\u8bae\u662f\uff1a\u7f51\u7edc\u969c\u788d\u90fd\u5fc5\u987b\u60f3\u529e\u6cd5\u514b\u670d\uff0c\u4e0d\u7136\u8fde Kubernetes \u7684\u95e8\u90fd\u8fdb\u4e0d\u4e86\u3002<\/p>\n<h1 id=\"\u8bbe\u7f6e\u4e3b\u673a\u540d\"><a name=\"t1\"><\/a>\u8bbe\u7f6e\u4e3b\u673a\u540d<\/h1>\n<p>\u5206\u522b\u4f7f\u7528hostname\u547d\u4ee4\u628a\u4e3b\u673a\u540d\u79f0\u8bbe\u7f6e\u4e3ak8s\uff0ck8s1,k8s2<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">hostname k8s\nhostname k8s1\nhostname k8s2<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u7136\u540e\u7f16\u8f91\u5bf9\u5e94\u5173\u7cfb\uff0c\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">vi \/etc\/hosts<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u5165\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">192.168.11.90  k8s\n192.168.11.91  k8s1\n192.168.11.92  k8s2<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<h1 id=\"\u5b89\u88c5\u65b9\u5f0f\u9009\u62e9\"><a name=\"t2\"><\/a>\u5b89\u88c5\u65b9\u5f0f\u9009\u62e9<\/h1>\n<p>\u76ee\u524d\u6709\u4e09\u79cd\u5b89\u88c5\u65b9\u5f0f<\/p>\n<p>\u4e0b\u9762\u7ed9\u51fa\u4e24\u79cd\u5b89\u88c5\u65b9\u5f0f\uff1a<br \/>\n\u7b2c\u4e00\u79cd\u662fyum\u5b89\u88c5<br \/>\n\u914d\u7f6eyum\u6e90\u540e\uff0c\u4f7f\u7528yum\u5b89\u88c5\uff0c\u597d\u5904\u662f\u7b80\u5355\uff0c\u574f\u5904\u4e5f\u5f88\u660e\u663e\uff0c\u9700\u8981google\u66f4\u65b0yum\u6e90\u624d\u80fd\u83b7\u5f97\u6700\u65b0\u7248\u672c\u7684\u8f6f\u4ef6\uff0c\u800c\u6240\u6709\u8f6f\u4ef6\u7684\u4f9d\u8d56\u53c8\u4e0d\u80fd\u81ea\u5df1\u6307\u5b9a\uff0c\u5c24\u5176\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\u5982\u679c\u4f4e\u7684\u8bdd\uff0c\u4f7f\u7528yum\u6e90\u5b89\u88c5\u7684kubernetes\u7684\u7248\u672c\u4e5f\u4f1a\u53d7\u5230\u9650\u5236\u3002<\/p>\n<p>\u7b2c\u4e00\u79cd\u662f\u4e8c\u8fdb\u5236\u5b89\u88c5<br \/>\n\u4f7f\u7528\u4e8c\u8fdb\u5236\u6587\u4ef6\u5b89\u88c5\uff0c\u597d\u5904\u662f\u53ef\u4ee5\u5b89\u88c5\u4efb\u610f\u7248\u672c\u7684kubernetes\uff0c\u574f\u5904\u662f\u914d\u7f6e\u6bd4\u8f83\u590d\u6742\u3002<\/p>\n<p>\u7b2c\u4e09\u79cd\u662fkubeadm\u5b89\u88c5<br \/>\nkubeadm\u662fKubernetes\u5b98\u65b9\u63d0\u4f9b\u7684\u7528\u4e8e\u5feb\u901f\u5b89\u88c5Kubernetes\u96c6\u7fa4\u7684\u5de5\u5177\uff0c\u4f34\u968fKubernetes\u6bcf\u4e2a\u7248\u672c\u7684\u53d1\u5e03\u90fd\u4f1a\u540c\u6b65\u66f4\u65b0\uff0ckubeadm\u4f1a\u5bf9\u96c6\u7fa4\u914d\u7f6e\u65b9\u9762\u7684\u4e00\u4e9b\u5b9e\u8df5\u505a\u8c03\u6574\uff0c\u901a\u8fc7\u5b9e\u9a8ckubeadm\u53ef\u4ee5\u5b66\u4e60\u5230Kubernetes\u5b98\u65b9\u5728\u96c6\u7fa4\u914d\u7f6e\u4e0a\u4e00\u4e9b\u65b0\u7684\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n<p>1.4\u7248\u672c\u5bf9\u4e8eLinux\u4e3b\u8981\u53d1\u884c\u7248\u672cUbuntu Xenial\u548cRed Hat centos7\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u719f\u6089\u7684apt-get\u548cyum\u6765\u76f4\u63a5\u5b89\u88c5Kubernetes\u3002\u518d\u6bd4\u5982\uff0c1.4\u7248\u672c\u5f15\u5165\u4e86kubeadm\u547d\u4ee4\uff0c\u5c06\u96c6\u7fa4\u542f\u52a8\u7b80\u5316\u4e3a\u4e24\u6761\u547d\u4ee4\uff0c\u4e0d\u9700\u8981\u518d\u4f7f\u7528\u590d\u6742\u7684kube-up\u811a\u672c\u3002<\/p>\n<p>Kubernetes\u7684\u5b98\u65b9\u6587\u6863\u66f4\u65b0\u7684\u901f\u5ea6\u592a\u5feb\u4e86\uff0c\u6211\u4eec\u6ce8\u610f\u5230\u5728Kubernetes 1.9\u7684\u6587\u6863Using kubeadm to Create a Cluster\u4e2d\u5df2\u7ecf\u7ed9\u51fa\u4e86\u76ee\u524d1.9\u7684kubeadm\u7684\u4e3b\u8981\u7279\u6027\u5df2\u7ecf\u5904\u4e8ebeta\u72b6\u6001\u4e86\uff0c\u57282018\u5e74\u5c06\u8fdb\u5165GA\u72b6\u6001\uff0c\u8bf4\u660ekubeadm\u79bb\u53ef\u4ee5\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u7684\u8ddd\u79bb\u8d8a\u6765\u8d8a\u8fd1\u4e86\u3002<\/p>\n<p>\u6211\u4eec\u9009\u62e9\u4f7f\u7528\u7b2c\u4e09\u79cd\u65b9\u5f0fkubeadm\u5b89\u88c5\u3002<\/p>\n<p>\u6587\u672b\u8f6c\u8f7d\u5176\u4ed6\u6587\u7ae0\u7684CentOS7\u7b2c\u4e00\u7b2c\u4e8c\u79cd\u5b89\u88c5\u65b9\u5f0f\u4ee5\u4f9b\u53c2\u8003\u3002<\/p>\n<h1 id=\"\u7248\u672c\u9009\u62e9\"><a name=\"t3\"><\/a>\u7248\u672c\u9009\u62e9<\/h1>\n<p>\u6839\u636e\u7cfb\u7edf\u548c\u5185\u6838\u7684\u7248\u672c\uff0c\u9002\u5408\u5b89\u88c5\u7684\u7248\u672c\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u6211\u4eec\u5fc5\u987b\u5148\u6536\u96c6\u597d\u76f8\u5173\u5bf9\u5e94\u7684\u7248\u672c\u6570\u636e\uff0c\u76ee\u524d\u7684\u7248\u672c\u652f\u6301\u54ea\u4e9b\u7248\u672c\u7684docker\u548ck8s\uff0c\u518d\u5f00\u59cb\u5b89\u88c5\uff0c\u624d\u80fd\u4e8b\u534a\u529f\u500d\uff0c\u5426\u5219\u4f1a\u51fa\u73b0\u5f88\u591a\u95ee\u9898\u3002<\/p>\n<p>\u63a8\u8350\u51e0\u4e2a\u5339\u914d\u7684\u7248\u672c\u5982\u4e0b:<br \/>\ncentos7\u7cfb\u7edf\u73af\u5883<br \/>\nCentos 7.2.1511<br \/>\ndocker 1.12.6<br \/>\netcd 3.1.5<br \/>\nkubernetes 1.6.0<br \/>\nflannel 0.7.0-1<\/p>\n<p>\u6216\u8005<br \/>\nCentOS 7.4<br \/>\ndocker 17.03.2<br \/>\nkubernetes 1.9.0<\/p>\n<p>centos6\u7cfb\u7edf\u73af\u5883<br \/>\ncentos6<br \/>\ndocker-1.7<br \/>\nk8s-1.2<\/p>\n<p>\u5728centos6 + docker-1.7 + k8s-1.2 \u662f\u80fd\u7528\u8d77\u6765\uff0c\u5b89\u88c5\u4e86dashboard\u3001nexus2\u3001harbor\uff0c\u4f46\u662f\u5bf9\u4e8e\u4e00\u4e9b\u65b0\u7684\u4e1c\u897f\u4e0d\u80fd\u7528\uff0c\u5e76\u4e14k8s\u5b98\u7f51\u6587\u6863\u4e0d\u5206\u7248\u672c\u5e76\u4e14\u6ca1\u8bb2\u660e\u767ddocker\u517c\u5bb9\u7684\u7248\u672c\uff08\u81f3\u5c11\u5b98\u7f51\u6587\u6863\uff09\uff0c\u611f\u89c9\u4eba\u5bb6\u5c31\u662f\u884c\u5230\u81ea\u5df1\u8fd9\u91cc\u5c31\u4e0d\u884c\uff0c\u5404\u79cd\u6298\u817e\u7136\u540e\u5230\u540e\u9762\u662f\u7248\u672c\u95ee\u9898\u3002docker\u548ck8s\u5728\u5bb9\u5668\u5927\u70ed\u7684\u5f53\u524d\uff0c\u7248\u672c\u66f4\u65b0\u592a\u5feb\u4e86\uff0cdocker\u90fd\u52301.17\u4e86\u3002\u7efc\u4e0a\uff0c\u5982\u679c\u5728centos6\u4e0a\u9762\u73a9\u73a9\u4e86\u89e3k8s\u7684\u6982\u51b5\u8fd8\u662f\u597d\u7684\uff0c\u4f46\u662f\u771f\u7684\u751f\u4ea7\u73af\u5883\u8981\u7528\u8fd8\u662f\u5347\u7ea7centos7\u6216\u8005\u4f7f\u7528ubuntu\u5427\u3002<br \/>\n\u66f4\u591a\u76f8\u5173\u60c5\u51b5<br \/>\n<a title=\"k8s\u5728Centos6\u90e8\u7f72\u5b9e\u8df5\" href=\"http:\/\/www.winseliu.com\/blog\/2017\/03\/05\/k8s-docker-multinode-on-centos6\/\" target=\"_blank\" rel=\"nofollow noopener\">k8s\u5728Centos6\u90e8\u7f72\u5b9e\u8df5<\/a><\/p>\n<p>\u56e0\u4e3acentOS6 \u5728\u751f\u4ea7\u73af\u5883\u4e2d\u610f\u4e49\u4e0d\u5927\uff0c\u4f7f\u7528\u8d77\u6765\u7248\u672c\u8f83\u8001\uff0c\u95ee\u9898\u4e5f\u5f88\u591a\uff0c\u6240\u4ee5\u6211\u4eec\u8bb0\u5f55\u5728centOS7\u4e2d\u5b89\u88c5k8s\u7684\u6b65\u9aa4\u3002\u7248\u672c\u9009\u62e9\u5982\u4e0b:<br \/>\nCentOS 7.4<br \/>\ndocker 17.03.2<br \/>\nkubernetes 1.9.0<\/p>\n<h1 id=\"\u4f7f\u7528kubeadm\u5b89\u88c5kubernetes\"><a name=\"t4\"><\/a>\u4f7f\u7528kubeadm\u5b89\u88c5Kubernetes<\/h1>\n<p>\u6ce8\u610f \u4ee5\u4e0b\u547d\u4ee4\uff0c\u975eroot\u7528\u6237\u9700\u8981sudo\u6743\u9650\u5e26sudo \u6267\u884c\u76f8\u5173\u547d\u4ee4\u3002<br \/>\nroot\u7528\u6237\u53bb\u6389sudo\u6267\u884c\u3002<\/p>\n<h2 id=\"\u5173\u95ed\u9632\u706b\u5899\"><a name=\"t5\"><\/a>\u5173\u95ed\u9632\u706b\u5899<\/h2>\n<p>\u5982\u679c\u5404\u4e2a\u4e3b\u673a\u542f\u7528\u4e86\u9632\u706b\u5899\uff0c\u9700\u8981\u5f00\u653eKubernetes\u5404\u4e2a\u7ec4\u4ef6\u6240\u9700\u8981\u7684\u7aef\u53e3\uff0c\u53ef\u4ee5\u67e5\u770bInstalling kubeadm\u4e2d\u7684\u201d<a title=\"Check required ports\" href=\"https:\/\/kubernetes.io\/docs\/tasks\/tools\/install-kubeadm\/\" target=\"_blank\" rel=\"nofollow noopener\">Check required ports<\/a>\u201d\u4e00\u8282\u3002 \u8fd9\u91cc\u7b80\u5355\u8d77\u89c1\u5728\u5404\u8282\u70b9\u7981\u7528\u9632\u706b\u5899\uff1a<\/p>\n<p>centOS 7.0\u7248\u672c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">sudo<\/span> systemctl stop firewalld.service   <span class=\"hljs-comment\">#\u505c\u6b62firewall<\/span>\n<span class=\"hljs-built_in\">sudo<\/span> systemctl disable firewalld.service <span class=\"hljs-comment\">#\u7981\u6b62firewall\u5f00\u673a\u542f\u52a8<\/span>\n<span class=\"hljs-built_in\">sudo<\/span> firewall-cmd --state             <span class=\"hljs-comment\">#\u67e5\u770b\u9632\u706b\u5899\u72b6\u6001<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<h2 id=\"\u7981\u7528selinux\"><a name=\"t6\"><\/a>\u7981\u7528SELINUX<\/h2>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">sudo<\/span> setenforce <span class=\"hljs-number\">0<\/span>\n<span class=\"hljs-built_in\">sudo<\/span> vi \/etc\/selinux\/config\n<span class=\"hljs-comment\">#SELINUX\u4fee\u6539\u4e3adisabled<\/span>\nSELINUX=disabled <\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<p>\u521b\u5efa\/etc\/sysctl.d\/k8s.conf\u6587\u4ef6<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">sudo vi \/etc\/sysctl<span class=\"hljs-preprocessor\">.d<\/span>\/k8s<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">net<span class=\"hljs-preprocessor\">.bridge<\/span><span class=\"hljs-preprocessor\">.bridge<\/span>-nf-<span class=\"hljs-keyword\">call<\/span>-ip6tables = <span class=\"hljs-number\">1<\/span>\nnet<span class=\"hljs-preprocessor\">.bridge<\/span><span class=\"hljs-preprocessor\">.bridge<\/span>-nf-<span class=\"hljs-keyword\">call<\/span>-iptables = <span class=\"hljs-number\">1<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u4f7f\u4fee\u6539\u751f\u6548,\u6267\u884c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">sudo sysctl -p \/etc\/sysctl<span class=\"hljs-preprocessor\">.d<\/span>\/k8s<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u53ef\u80fd\u9047\u5230\u95ee\u9898\u2014is an unknown key<br \/>\n\u62a5\u9519<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vbnet has-numbering\"><span class=\"hljs-keyword\">error<\/span>: <span class=\"hljs-string\">\"net.bridge.bridge-nf-call-ip6tables\"<\/span> <span class=\"hljs-keyword\">is<\/span> an unknown <span class=\"hljs-keyword\">key<\/span>\n<span class=\"hljs-keyword\">error<\/span>: <span class=\"hljs-string\">\"net.bridge.bridge-nf-call-iptables\"<\/span> <span class=\"hljs-keyword\">is<\/span> an unknown <span class=\"hljs-keyword\">key<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u65b9\u6cd5<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">sudo<\/span> modprobe bridge\n<span class=\"hljs-built_in\">sudo<\/span> lsmod |grep bridge\n<span class=\"hljs-built_in\">sudo<\/span> sysctl -p \/etc\/sysctl.d\/k8s.conf<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u53ef\u80fd\u9047\u5230\u95ee\u9898\u2013sysctl: cannot stat \/proc\/sys\/net\/bridge\/bridge-nf-call-ip6tables: \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55<br \/>\n\u62a5\u9519<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">[root@localhost ~]<span class=\"hljs-preprocessor\"># sysctl -p \/etc\/sysctl.d\/k8s.conf<\/span>\n<span class=\"hljs-label\">sysctl:<\/span> cannot stat \/proc\/sys\/net\/bridge\/bridge-nf-<span class=\"hljs-keyword\">call<\/span>-ip6tables: \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\n<span class=\"hljs-label\">sysctl:<\/span> cannot stat \/proc\/sys\/net\/bridge\/bridge-nf-<span class=\"hljs-keyword\">call<\/span>-iptables: \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u65b9\u6cd5<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">modprobe br_netfilter\nls \/proc\/sys\/net\/bridge\nsudo sysctl -p \/etc\/sysctl<span class=\"hljs-preprocessor\">.d<\/span>\/k8s<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904:<a title=\"kubernetes---CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248\" href=\"http:\/\/www.525.life\/article?id=1510739742331\" target=\"_blank\" rel=\"nofollow noopener\">kubernetes\u2014CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248<\/a><\/p>\n<h2 id=\"\u5b89\u88c5docker\"><a name=\"t7\"><\/a>\u5b89\u88c5Docker<\/h2>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">sudo yum install <span class=\"hljs-attribute\">-y<\/span> yum<span class=\"hljs-attribute\">-utils<\/span> device<span class=\"hljs-attribute\">-mapper<\/span><span class=\"hljs-attribute\">-persistent<\/span><span class=\"hljs-attribute\">-data<\/span> lvm2<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u4ee5\u53ca<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">sudo yum-config-manager \\\n    --<span class=\"hljs-keyword\">add<\/span>-repo \\\n    https:\/\/download<span class=\"hljs-preprocessor\">.docker<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/linux\/centos\/docker-ce<span class=\"hljs-preprocessor\">.repo<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u67e5\u770b\u5f53\u524d\u7684Docker\u7248\u672c\uff1a<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">sudo yum <span class=\"hljs-built_in\">list<\/span> docker<span class=\"hljs-attribute\">-ce<\/span><span class=\"hljs-built_in\">.<\/span>x86_64  <span class=\"hljs-subst\">--<\/span>showduplicates <span class=\"hljs-subst\">|<\/span>sort <span class=\"hljs-attribute\">-r<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">[zzq@localhost ~]$ sudo yum list docker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64  --showduplicates |sort -r\n * updates: mirrors<span class=\"hljs-preprocessor\">.aliyun<\/span><span class=\"hljs-preprocessor\">.com<\/span>\nLoading mirror speeds from cached hostfile\nLoaded plugins: fastestmirror, priorities\n * extras: mirrors<span class=\"hljs-preprocessor\">.aliyun<\/span><span class=\"hljs-preprocessor\">.com<\/span>\n * elrepo: mirrors<span class=\"hljs-preprocessor\">.tuna<\/span><span class=\"hljs-preprocessor\">.tsinghua<\/span><span class=\"hljs-preprocessor\">.edu<\/span><span class=\"hljs-preprocessor\">.cn<\/span>\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">18.03<\/span><span class=\"hljs-number\">.1<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">18.03<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.12<\/span><span class=\"hljs-number\">.1<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.12<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.09<\/span><span class=\"hljs-number\">.1<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.09<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.06<\/span><span class=\"hljs-number\">.2<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.06<\/span><span class=\"hljs-number\">.1<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.06<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.03<\/span><span class=\"hljs-number\">.2<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.03<\/span><span class=\"hljs-number\">.1<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\ndocker-ce<span class=\"hljs-preprocessor\">.x<\/span>86_64            <span class=\"hljs-number\">17.03<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span>             docker-ce-stable\n * base: mirrors<span class=\"hljs-preprocessor\">.aliyun<\/span><span class=\"hljs-preprocessor\">.com<\/span>\nAvailable Packages\n[zzq@localhost ~]$ <\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<\/ul>\n<p>Kubernetes 1.8\u5df2\u7ecf\u9488\u5bf9Docker\u76841.11.2, 1.12.6, 1.13.1\u548c17.03\u7b49\u7248\u672c\u505a\u4e86\u9a8c\u8bc1\u3002 \u56e0\u6b64\u6211\u4eec\u8fd9\u91cc\u5728\u5404\u8282\u70b9\u5b89\u88c5docker\u768417.03.2\u7248\u672c\u3002<br \/>\n\u4f7f\u7528\u547d\u4ee4\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">sudo<\/span> yum makecache fast<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u4ee5\u53ca<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">sudo yum install -<span class=\"hljs-built_in\">y<\/span> --setopt=obsoletes=<span class=\"hljs-number\">0<\/span> \\\n  docker-ce-<span class=\"hljs-number\">17.03<\/span><span class=\"hljs-number\">.2<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span> \\\n  docker-ce-selinux-<span class=\"hljs-number\">17.03<\/span><span class=\"hljs-number\">.2<\/span><span class=\"hljs-preprocessor\">.ce<\/span>-<span class=\"hljs-number\">1.<\/span>el7<span class=\"hljs-preprocessor\">.centos<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vhdl has-numbering\">\u83b7\u53d6 GPG \u5bc6\u94a5\u5931\u8d25\uff1a[Errno <span class=\"hljs-number\">12<\/span>] Timeout <span class=\"hljs-keyword\">on<\/span> https:\/\/download.docker.com\/linux\/centos\/gpg: (<span class=\"hljs-number\">28<\/span>, <span class=\"hljs-attribute\">'Operation<\/span> timed <span class=\"hljs-keyword\">out<\/span> <span class=\"hljs-keyword\">after<\/span> <span class=\"hljs-number\">30002<\/span> milliseconds <span class=\"hljs-keyword\">with<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-keyword\">out<\/span> <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-number\">0<\/span> bytes received')<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u65b9\u6cd5<br \/>\n\u4e00\u822c\u8d85\u65f6\u539f\u56e0\u90fd\u662f\u7f51\u7edc\u95ee\u9898\uff0c\u9700\u8981\u68c0\u67e5\u7f51\u7edc\u4ee5\u53ca\u80fd\u591f\u76f4\u63a5\u8bbf\u95ee\u5230\u8fd9\u4e2a\u8d44\u6e90\u6bd4\u5982\u4f7f\u7528\u547d\u4ee4:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ruby has-numbering\">curl -l <span class=\"hljs-symbol\">https:<\/span>\/<span class=\"hljs-regexp\">\/download.docker.com\/linux<\/span><span class=\"hljs-regexp\">\/centos\/gpg<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<h2 id=\"\u542f\u52a8\u548c\u505c\u6b62docker\"><a name=\"t8\"><\/a>\u542f\u52a8\u548c\u505c\u6b62docker<\/h2>\n<p>centOS7<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">sudo<\/span> systemctl start docker<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>centOS6<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">sudo<\/span> service docker start<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>Docker\u4ece1.13\u7248\u672c\u5f00\u59cb\u8c03\u6574\u4e86\u9ed8\u8ba4\u7684\u9632\u706b\u5899\u89c4\u5219\uff0c\u7981\u7528\u4e86iptables filter\u8868\u4e2dFOWARD\u94fe\uff0c\u8fd9\u6837\u4f1a\u5f15\u8d77Kubernetes\u96c6\u7fa4\u4e2d\u8de8Node\u7684Pod\u65e0\u6cd5\u901a\u4fe1\uff0c\u5728\u5404\u4e2aDocker\u8282\u70b9\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">sudo<\/span> iptables -P FORWARD ACCEPT<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u540c\u65f6\u5728docker\u7684systemd unit\u6587\u4ef6\u4e2d\u4ee5ExecStartPost\u52a0\u5165\u5141\u8bb8\u8bbf\u95ee\u7684\u4ee3\u7801\uff0c\u4f7f\u7528\u547d\u4ee4\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\"><span class=\"hljs-preprocessor\"># \u4e3adocker\u670d\u52a1\u521b\u5efa\u4e00\u4e2asystemd\u63d2\u4ef6\u76ee\u5f55<\/span>\nmkdir -p \/etc\/systemd\/system\/docker<span class=\"hljs-preprocessor\">.service<\/span><span class=\"hljs-preprocessor\">.d<\/span>\n<span class=\"hljs-preprocessor\"># \u521b\u5efa\u4e00\u4e2a\/etc\/systemd\/system\/docker.service.d\/port.conf\u914d\u7f6e\u6587\u4ef6<\/span>\nvi \/etc\/systemd\/system\/docker<span class=\"hljs-preprocessor\">.service<\/span><span class=\"hljs-preprocessor\">.d<\/span>\/port<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<p>\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9,\u4fdd\u5b58\u9000\u51fa:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs fix has-numbering\"><span class=\"hljs-attribute\">ExecStartPost<\/span>=<span class=\"hljs-string\">\/usr\/sbin\/iptables -P FORWARD ACCEPT<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u91cd\u542fdocker\u670d\u52a1<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">systemctl daemon<span class=\"hljs-attribute\">-reload<\/span>\nsystemctl restart docker<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<h2 id=\"\u5b89\u88c5kubeadm\u548ckubelet\"><a name=\"t9\"><\/a>\u5b89\u88c5kubeadm\u548ckubelet<\/h2>\n<p>\u4e0b\u9762\u5728\u5404\u8282\u70b9\u5b89\u88c5kubeadm\u548ckubelet,\u7f16\u8f91\u8d44\u6e90\u5e93<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">vi   \/etc\/yum<span class=\"hljs-preprocessor\">.repos<\/span><span class=\"hljs-preprocessor\">.d<\/span>\/kubernetes<span class=\"hljs-preprocessor\">.repo<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u5165\u5982\u4e0b\u5185\u5bb9:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">[kubernetes]\nname=Kubernetes\nbaseurl=https:\/\/packages<span class=\"hljs-preprocessor\">.cloud<\/span><span class=\"hljs-preprocessor\">.google<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/yum\/repos\/kubernetes-el7-x86_64\nenabled=<span class=\"hljs-number\">1<\/span>\ngpgcheck=<span class=\"hljs-number\">1<\/span>\nrepo_gpgcheck=<span class=\"hljs-number\">1<\/span>\ngpgkey=https:\/\/packages<span class=\"hljs-preprocessor\">.cloud<\/span><span class=\"hljs-preprocessor\">.google<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/yum\/doc\/yum-key<span class=\"hljs-preprocessor\">.gpg<\/span>\n        https:\/\/packages<span class=\"hljs-preprocessor\">.cloud<\/span><span class=\"hljs-preprocessor\">.google<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/yum\/doc\/rpm-package-key<span class=\"hljs-preprocessor\">.gpg<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<\/ul>\n<p>\u4f7f\u7528\u547d\u4ee4\u6d4b\u8bd5\u5730\u5740\u662f\u5426\u53ef\u7528<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">curl https:\/\/packages<span class=\"hljs-preprocessor\">.cloud<\/span><span class=\"hljs-preprocessor\">.google<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/yum\/repos\/kubernetes-el7-x86_64<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5982\u679c\u4e0d\u53ef\u7528\u9700\u8981\u79d1\u5b66\u4e0a\u7f51\u3002<br \/>\n\u53ef\u4ee5\u8d2d\u4e70\u9999\u6e2f\u6216\u8005\u7f8e\u56fd\u7684\u670d\u52a1\u5668\u53c2\u8003\u8fd9\u4e24\u7bc7\u6587\u7ae0:<br \/>\n<a title=\"\u642d\u5efashadowsocks\" href=\"http:\/\/www.525.life\/article?id=1508325375708\" target=\"_blank\" rel=\"nofollow noopener\">\u642d\u5efashadowsocks<\/a><br \/>\n<a title=\"linux\u4f7f\u7528shadowsocks\" href=\"http:\/\/www.525.life\/article?id=1510739742371\" target=\"_blank\" rel=\"nofollow noopener\">linux\u4f7f\u7528shadowsocks<\/a><\/p>\n<p>\u5982\u679c\u80fd\u6b63\u5e38\u8bbf\u95ee\u7ee7\u7eed\u5b89\u88c5\uff0c\u4f7f\u7528\u547d\u4ee4\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs cmake has-numbering\">yum makecache fast\nyum <span class=\"hljs-keyword\">install<\/span> -y kubelet kubeadm kubectl<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs css has-numbering\">\u5df2\u5b89\u88c5:\n  <span class=\"hljs-tag\">kubeadm<\/span><span class=\"hljs-class\">.x86_64<\/span> 0<span class=\"hljs-pseudo\">:1<\/span><span class=\"hljs-class\">.11<\/span><span class=\"hljs-class\">.2-0<\/span>                                                                               <span class=\"hljs-tag\">kubectl<\/span><span class=\"hljs-class\">.x86_64<\/span> 0<span class=\"hljs-pseudo\">:1<\/span><span class=\"hljs-class\">.11<\/span><span class=\"hljs-class\">.2-0<\/span>                                                                               <span class=\"hljs-tag\">kubelet<\/span><span class=\"hljs-class\">.x86_64<\/span> 0<span class=\"hljs-pseudo\">:1<\/span><span class=\"hljs-class\">.11<\/span><span class=\"hljs-class\">.2-0<\/span>\n\n\u4f5c\u4e3a\u4f9d\u8d56\u88ab\u5b89\u88c5:\n  <span class=\"hljs-tag\">cri-tools<\/span><span class=\"hljs-class\">.x86_64<\/span> 0<span class=\"hljs-pseudo\">:1<\/span><span class=\"hljs-class\">.11<\/span><span class=\"hljs-class\">.0-0<\/span>                                                                            <span class=\"hljs-tag\">kubernetes-cni<\/span><span class=\"hljs-class\">.x86_64<\/span> 0<span class=\"hljs-pseudo\">:0<\/span><span class=\"hljs-class\">.6<\/span><span class=\"hljs-class\">.0-0<\/span>                                                                            <span class=\"hljs-tag\">socat<\/span><span class=\"hljs-class\">.x86_64<\/span> 0<span class=\"hljs-pseudo\">:1<\/span><span class=\"hljs-class\">.7<\/span><span class=\"hljs-class\">.3<\/span><span class=\"hljs-class\">.2-2<\/span><span class=\"hljs-class\">.el7<\/span>    <\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<\/ul>\n<p>\u5b89\u88c5\u7ed3\u679c\u53ef\u4ee5\u770b\u51fa\u5b89\u88c5\u7684\u4f9d\u8d56\u548c\u7248\u672c\u3002<br \/>\n\u5982\u679c\u6211\u4eec\u8981\u624b\u52a8\u5b89\u88c5\uff0c\u4e5f\u53ef\u4ee5\u53c2\u8003\u76f8\u5e94\u7684\u4f9d\u8d56\u7248\u672c\u3002<\/p>\n<h2 id=\"\u8c03\u6574\u542f\u52a8\u65b9\u5f0f\"><a name=\"t10\"><\/a>\u8c03\u6574\u542f\u52a8\u65b9\u5f0f<\/h2>\n<p>kubelet\u7684\u542f\u52a8\u73af\u5883\u53d8\u91cf\u8981\u4e0edocker\u7684cgroup-driver\u9a71\u52a8\u4e00\u6837\u3002<\/p>\n<p>\u67e5\u770bdocker\u7684cgroup-driver\u9a71\u52a8<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs nginx has-numbering\"><span class=\"hljs-title\">docker<\/span> <span class=\"hljs-built_in\">info<\/span>\n\u6216\u8005\ndocker <span class=\"hljs-built_in\">info<\/span> | grep -i cgroup<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">Cgroup Driver: cgroupfs<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u770b\u51fadocker 17.03\u4f7f\u7528\u7684Cgroup Driver\u4e3acgroupfs\u3002<\/p>\n<p>Kubernetes\u6587\u6863\u4e2dkubelet\u7684\u542f\u52a8\u53c2\u6570\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\"><span class=\"hljs-subst\">--<\/span>cgroup<span class=\"hljs-attribute\">-driver<\/span> <span class=\"hljs-built_in\">string<\/span> Driver that the kubelet uses <span class=\"hljs-keyword\">to<\/span> manipulate cgroups <span class=\"hljs-keyword\">on<\/span> the host<span class=\"hljs-built_in\">.<\/span>\nPossible values: <span class=\"hljs-string\">'cgroupfs'<\/span>, <span class=\"hljs-string\">'systemd'<\/span> (default <span class=\"hljs-string\">\"cgroupfs\"<\/span>)<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u9ed8\u8ba4\u503c\u4e3acgroupfs\uff0cyum\u5b89\u88c5kubelet,kubeadm\u65f6\u751f\u621010-kubeadm.conf\u6587\u4ef6\u4e2d\u53ef\u80fd\u5c06\u8fd9\u4e2a\u53c2\u6570\u503c\u6539\u6210\u4e86systemd\u3002<\/p>\n<p>\u67e5\u770bkubelet\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u5982\u4e0b\u5185\u5bb9\uff1a<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">cat \/etc\/systemd\/system\/kubelet<span class=\"hljs-preprocessor\">.service<\/span><span class=\"hljs-preprocessor\">.d<\/span>\/<span class=\"hljs-number\">10<\/span>-kubeadm<span class=\"hljs-preprocessor\">.conf<\/span>\n\u6216\u8005\ncat \/etc\/systemd\/system\/kubelet<span class=\"hljs-preprocessor\">.service<\/span><span class=\"hljs-preprocessor\">.d<\/span>\/<span class=\"hljs-number\">10<\/span>-kubeadm<span class=\"hljs-preprocessor\">.conf<\/span>|grep <span class=\"hljs-string\">\"cgroup-driver\"<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>1.11.2\u7248\u672c\u7684\u5c01\u88c5\u5728\/var\/lib\/kubelet\/kubeadm-flags.env\u6587\u4ef6\u4e2d<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">cat \/<span class=\"hljs-built_in\">var<\/span>\/lib\/kubelet\/kubeadm<span class=\"hljs-attribute\">-flags<\/span><span class=\"hljs-built_in\">.<\/span>env<span class=\"hljs-subst\">|<\/span>grep <span class=\"hljs-string\">\"cgroup-driver\"<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5982\u679c\u6ca1\u627e\u5230\u5219\u662f\u9ed8\u8ba4\u7684cgroupfs\uff0c\u4e0d\u9700\u8981\u4fee\u6539\u3002<\/p>\n<p>\u5982\u679c\u8f93\u51fa\u5982\u4e0b\u5219\u9700\u8981\u4fee\u6539\u6210\u4e00\u81f4\u7684\u65b9\u5f0f\uff0c\u5373\u53ef\u4ee5\u4fee\u653910-kubeadm.conf\u4e2d\u7684\u4e5f\u53ef\u4ee5\u4fee\u6539docker\u7684\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs fix has-numbering\"><span class=\"hljs-attribute\">KUBELET_CGROUP_ARGS<\/span>=<span class=\"hljs-string\">--cgroup-driver=systemd<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6211\u4eec\u8fd9\u91cc\u4fee\u6539\u5404\u8282\u70b9docker\u7684cgroup driver\u4f7f\u5176\u548ckubelet\u4e00\u81f4<\/p>\n<p>\u5373\u4fee\u6539\u6216\u521b\u5efa\/etc\/docker\/daemon.json<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">vi \/etc\/docker\/daemon<span class=\"hljs-preprocessor\">.json<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u52a0\u5165\u4e0b\u9762\u7684\u5185\u5bb9\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs json has-numbering\">{\n  \"<span class=\"hljs-attribute\">exec-opts<\/span>\": <span class=\"hljs-value\">[<span class=\"hljs-string\">\"native.cgroupdriver=systemd\"<\/span>]\n<\/span>}<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u91cd\u542fdocker:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">systemctl restart docker\nsystemctl status docker<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<h2 id=\"\u5904\u7406swap\"><a name=\"t11\"><\/a>\u5904\u7406swap<\/h2>\n<p>Kubernetes 1.8\u5f00\u59cb\u8981\u6c42\u5173\u95ed\u7cfb\u7edf\u7684Swap\uff0c\u5982\u679c\u4e0d\u5173\u95ed\uff0c\u9ed8\u8ba4\u914d\u7f6e\u4e0bkubelet\u5c06\u65e0\u6cd5\u542f\u52a8\u3002<br \/>\n\u53ef\u4ee5\u901a\u8fc7kubelet\u7684\u542f\u52a8\u53c2\u6570\u2013fail-swap-on=false\u66f4\u6539\u8fd9\u4e2a\u9650\u5236\u3002<\/p>\n<h3 id=\"\u65b9\u5f0f\u4e00\u5173\u95edswap\"><a name=\"t12\"><\/a>\u65b9\u5f0f\u4e00\u5173\u95edswap<\/h3>\n<p>\u5173\u95ed\u7cfb\u7edf\u7684Swap\u65b9\u6cd5\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\">swapoff <span class=\"hljs-operator\">-a<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u540c\u65f6\u8fd8\u9700\u8981\u4fee\u6539\/etc\/fstab\u6587\u4ef6\uff0c\u6ce8\u91ca\u6389 SWAP \u7684\u81ea\u52a8\u6302\u8f7d\uff0c\u9632\u6b62\u673a\u5b50\u91cd\u542f\u540eswap\u542f\u7528\u3002<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">vi \/etc\/fstab<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\"># \/etc\/fstab<\/span>\n<span class=\"hljs-preprocessor\"># Created by anaconda on Tue Jun 19 06:52:02 2018<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\"># Accessible filesystems, by reference, are maintained under '\/dev\/disk'<\/span>\n<span class=\"hljs-preprocessor\"># See man pages fstab(5), findfs(8), mount(8) and\/or blkid(8) for more info<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n\/dev\/mapper\/centos-root \/                       xfs     defaults        <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span>\nUUID=<span class=\"hljs-number\">2<\/span>d32a0e0-<span class=\"hljs-number\">9<\/span>bda-<span class=\"hljs-number\">4<\/span>a68-<span class=\"hljs-number\">9<\/span>abf-<span class=\"hljs-number\">6<\/span>a827a517177 \/boot                   xfs     defaults        <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span>\n\/dev\/mapper\/centos-swap swap                    swap    defaults        <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<\/ul>\n<p>\u6ce8\u91caswap\u8fd9\u4e00\u884c\u540e\u4fdd\u5b58\u9000\u51fa<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\">#\/dev\/mapper\/centos-swap swap                    swap    defaults        0 0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u786e\u8ba4swap\u5df2\u7ecf\u5173\u95ed\uff0c\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">free <span class=\"hljs-attribute\">-m<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>swap\u8f93\u51fa\u4e3a0\u5219\u8bf4\u660e\u5df2\u7ecf\u5173\u95ed\uff0c\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">[root@localhost ~]<span class=\"hljs-preprocessor\"># free -m<\/span>\n              total        used        free      shared  buff\/cache   available\n<span class=\"hljs-label\">Mem:<\/span>            <span class=\"hljs-number\">976<\/span>         <span class=\"hljs-number\">115<\/span>         <span class=\"hljs-number\">283<\/span>           <span class=\"hljs-number\">6<\/span>         <span class=\"hljs-number\">577<\/span>         <span class=\"hljs-number\">661<\/span>\n<span class=\"hljs-label\">Swap:<\/span>             <span class=\"hljs-number\">0<\/span>           <span class=\"hljs-number\">0<\/span>           <span class=\"hljs-number\">0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<p>k8s\u7684swappiness\u53c2\u6570\u8c03\u6574\uff0c\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">vi \/etc\/sysctl<span class=\"hljs-preprocessor\">.d<\/span>\/k8s<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6dfb\u52a0\u4e0b\u9762\u4e00\u884c\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs fix has-numbering\"><span class=\"hljs-attribute\">vm.swappiness<\/span>=<span class=\"hljs-string\">0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6267\u884c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">sysctl -p \/etc\/sysctl<span class=\"hljs-preprocessor\">.d<\/span>\/k8s<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u4f7f\u4fee\u6539\u751f\u6548\u3002<\/p>\n<h3 id=\"\u65b9\u5f0f\u4e8c\u53bb\u6389swap\u7684\u9650\u5236\"><a name=\"t13\"><\/a>\u65b9\u5f0f\u4e8c\u53bb\u6389swap\u7684\u9650\u5236<\/h3>\n<p>\u56e0\u4e3a\u4e3b\u673a\u4e0a\u8fd8\u8fd0\u884c\u5176\u4ed6\u670d\u52a1\uff0c\u5173\u95edswap\u53ef\u80fd\u4f1a\u5bf9\u5176\u4ed6\u670d\u52a1\u4ea7\u751f\u5f71\u54cd\uff0c\u5219\u4fee\u6539kubelet\u7684\u542f\u52a8\u53c2\u6570\u53bb\u6389\u8fd9\u4e2a\u9650\u5236\u3002<br \/>\n\u4fee\u6539\/etc\/systemd\/system\/kubelet.service.d\/10-kubeadm.conf<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">vi \/etc\/systemd\/system\/kubelet<span class=\"hljs-preprocessor\">.service<\/span><span class=\"hljs-preprocessor\">.d<\/span>\/<span class=\"hljs-number\">10<\/span>-kubeadm<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u52a0\u5165\u5185\u5bb9:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs mathematica has-numbering\"><span class=\"hljs-keyword\">Environment<\/span>=<span class=\"hljs-string\">\"KUBELET_EXTRA_ARGS=--fail-swap-on=false\"<\/span>\nsystemctl daemon-reload<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<h2 id=\"\u542f\u52a8kubelet\u670d\u52a1\"><a name=\"t14\"><\/a>\u542f\u52a8kubelet\u670d\u52a1<\/h2>\n<p>\u5728\u5404\u8282\u70b9\u5f00\u673a\u542f\u52a8kubelet\u670d\u52a1<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">systemctl enable kubelet<span class=\"hljs-preprocessor\">.service<\/span>\nsystemctl start kubelet<span class=\"hljs-preprocessor\">.service<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<h2 id=\"\u51c6\u5907\u955c\u50cf\"><a name=\"t15\"><\/a>\u51c6\u5907\u955c\u50cf<\/h2>\n<p>Kubernetes\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u4e00\u4e2a\u5f88\u5927\u7684\u95ee\u9898\uff0c\u76f8\u5173\u7ec4\u4ef6\u7684\u955c\u50cf\u90fd\u662f\u6258\u7ba1\u5728Google Container Registry\u4e0a\u7684\u3002\u56fd\u5185\u7684\u955c\u50cf\u52a0\u901f\u4e00\u822c\u9488\u5bf9\u7684\u662fDockerhub\u4e0a\u7684\u955c\u50cf\u3002\u6240\u4ee5\u56fd\u5185\u7684\u670d\u52a1\u5668\u662f\u6ca1\u6cd5\u76f4\u63a5\u5b89\u88c5GCR\u4e0a\u7684\u955c\u50cf\u7684\u3002<br \/>\n\u6ce8\u610f\uff0c\u8fd9\u91cc\u5373\u4f7f\u7ffb\u5899\u4e4b\u540e\uff0c\u5728\u6267\u884c\u521d\u59cb\u5316\u65f6\u4ecd\u7136\u4f1a\u62a5\u9519<br \/>\n\u6240\u6709\u6700\u597d\u7684\u89e3\u51b3\u65b9\u6cd5\u662f \u5728\u53ef\u8bbf\u95eegcr.io\/google-containers\u7684\u56fd\u5916\u8282\u70b9(\u4e00\u822c\u5728aws\u6216\u8005\u5168\u5c40\u8bbf\u95ee\u5916\u7f51\u7684\u8282\u70b9)\u4e2d\uff0c\u628agcr.io\u7684\u955c\u50cf\u62c9\u5230\u53ef\u8bbf\u95ee\u7684\u955c\u50cf\u4ed3\u5e93\u4e2d\uff0c\u4f8b\u5982Docker Hub\u6216\u8005\u963f\u91cc\u4e91\u7b49\u3002<\/p>\n<p>\u8bbe\u7f6e\u5168\u5c40\u4ee3\u7406\u540e\u6d4f\u89c8\u5668\u8bbf\u95ee gcr.io\/google-containers \u663e\u793a\u5982\u4e0b:<br \/>\n<img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/FtHOnfy0aamBDcZ-ifpry_3Cgv3I\" alt=\"\" \/><\/p>\n<h3 id=\"\u65b0\u5efa\u4ed3\u5e93\"><a name=\"t16\"><\/a>\u65b0\u5efa\u4ed3\u5e93<\/h3>\n<p>\u6211\u4eec\u8fd9\u91cc\u4f7f\u7528\u963f\u91cc\u4e91\u7684\u955c\u50cf\u4ed3\u5e93\u4f5c\u4e3a\u6f14\u793a\u3002<br \/>\n\u963f\u91cc\u4e91\u955c\u50cf\u4ed3\u5e93\u9700\u8981\u6ce8\u518c\u767b\u5f55\u8bbf\u95ee\u5730\u5740\u5982\u4e0b\uff1a<br \/>\n<a href=\"https:\/\/cr.console.aliyun.com\/cn-hangzhou\/repositories\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/cr.console.aliyun.com\/cn-hangzhou\/repositories<\/a><\/p>\n<p>\u6839\u636e\u5982\u4e0b\u6b65\u9aa4:<br \/>\n\u521b\u5efa\u955c\u50cf\u4ed3\u5e93<br \/>\n\u547d\u540d-\u516c\u5f00<br \/>\n\u672c\u5730\u4ed3\u5e93<br \/>\n\u521b\u5efa\u5b8c\u6210\u540e\u70b9\u51fb\u7ba1\u7406<br \/>\n\u8fd9\u6837\u6211\u4eec\u5c31\u62ff\u5230\u4e86\u8fd9\u4e2a\u955c\u50cf\u4ed3\u5e93\u7684\u516c\u7f51\u5730\u5740<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">registry<span class=\"hljs-preprocessor\">.cn<\/span>-qingdao<span class=\"hljs-preprocessor\">.aliyuncs<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/joe-k8s\/k8s<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u767b\u5f55\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">docker login --username=xxx registry<span class=\"hljs-preprocessor\">.cn<\/span>-qingdao<span class=\"hljs-preprocessor\">.aliyuncs<\/span><span class=\"hljs-preprocessor\">.com<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u767b\u5f55\u5bc6\u7801\u5728 \u9996\u9875\u8bbe\u7f6e<br \/>\n<img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/FkeoSHsKPtlXsTtWhCmXUO4nE0Vl\" alt=\"\" \/><br \/>\n<img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/FlZYwtojo7MOtoY9oem9iDvWmxR_\" alt=\"\" \/><br \/>\n<img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/Fs0u5ddUBPadwOV-UWPMShhRwWHh\" alt=\"\" \/><br \/>\n<img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/Foy2vDkvyPAAWY_t9V-FqQxetpdf\" alt=\"\" \/><br \/>\n<img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/Fve5AVvXySVg7Q8Ok3vJ8euFjyYv\" alt=\"\" \/><\/p>\n<p>\u9996\u5148\u767b\u5f55 \u4ed3\u5e93<br \/>\n\u8fd0\u884c\u547d\u4ee4<br \/>\n\u767b\u5f55\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">docker login --username=xxx registry<span class=\"hljs-preprocessor\">.cn<\/span>-qingdao<span class=\"hljs-preprocessor\">.aliyuncs<\/span><span class=\"hljs-preprocessor\">.com<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u5165\u5bc6\u7801\u3002<br \/>\n\u767b\u5f55\u6210\u529f\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ruby has-numbering\">[root<span class=\"hljs-variable\">@k8s<\/span> ~]<span class=\"hljs-comment\"># docker login --username=xxx registry.cn-qingdao.aliyuncs.com<\/span>\n<span class=\"hljs-constant\">Password<\/span><span class=\"hljs-symbol\">:<\/span>\n<span class=\"hljs-constant\">Login<\/span> <span class=\"hljs-constant\">Succeeded<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<h3 id=\"\u83b7\u53d6\u7248\u672c\u53f7\"><a name=\"t17\"><\/a>\u83b7\u53d6\u7248\u672c\u53f7<\/h3>\n<p>K8s\u6bcf\u4e2a\u7248\u672c\u9700\u8981\u7684\u955c\u50cf\u7248\u672c\u53f7\u5728<a title=\"kubeadm Setup Tool Reference Guide\" href=\"https:\/\/kubernetes.io\/docs\/reference\/setup-tools\/kubeadm\/kubeadm\/#custom-images\" target=\"_blank\" rel=\"nofollow noopener\">kubeadm Setup Tool Reference Guide<\/a>\u8fd9\u4e2a\u6587\u6863\u7684\u7684Running kubeadm without an internet connection\u4e00\u8282\u91cc\u6709\u5199\u3002\u6240\u4ee5\u53ef\u4ee5\u6839\u636e\u5b89\u88c5\u7684\u5b9e\u9645\u7248\u672c\u6765\u8c03\u6574\u8fd9\u4e2a\u811a\u672c\u7684\u53c2\u6570\u3002\u6ce8\u610f\u628a\u4e0a\u9762\u7684\u955c\u50cf\u5730\u5740\u6362\u6210\u81ea\u5df1\u7684\u3002k8s\u662f\u4f60\u521b\u5efa\u7684\u4e00\u4e2anamespace\uff0c\u800c\u4e0d\u662f\u4ed3\u5e93\u540d\u3002<br \/>\n<img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/ForGEchz3vxiLS9cU6jP8Fo0-peF\" alt=\"\" \/><\/p>\n<p>\u5982\u56fe\u53ef\u4ee5\u770b\u5230 1.11\u7248\u672c\u7684k8s\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u83b7\u53d6\u9700\u8981\u7684\u955c\u50cf\u7248\u672c\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs php has-numbering\">kubeadm config images <span class=\"hljs-keyword\">list<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">k8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-apiserver-amd64:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-controller-manager-amd64:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-scheduler-amd64:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-proxy-amd64:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/pause:<span class=\"hljs-number\">3.1<\/span>\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/etcd-amd64:<span class=\"hljs-number\">3.2<\/span><span class=\"hljs-number\">.18<\/span>\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/coredns:<span class=\"hljs-number\">1.1<\/span><span class=\"hljs-number\">.3<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<\/ul>\n<h3 id=\"\u51c6\u5907\u955c\u50cf\u4ed3\u5e93\"><a name=\"t18\"><\/a>\u51c6\u5907\u955c\u50cf\u4ed3\u5e93<\/h3>\n<h4 id=\"\u65b9\u5f0f\u4e00\u6709\u56fd\u5916\u670d\u52a1\u5668\u8282\u70b9\u7f16\u5199\u811a\u672c\u83b7\u53d6\u63a8\u9001\u955c\u50cf\">\u65b9\u5f0f\u4e00\u6709\u56fd\u5916\u670d\u52a1\u5668\u8282\u70b9\u7f16\u5199\u811a\u672c\u83b7\u53d6\u63a8\u9001\u955c\u50cf<\/h4>\n<p>\u5728\u56fd\u5916\u7684\u670d\u52a1\u5668\u8282\u70b9\u521b\u5efa\u811a\u672c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">vi <span class=\"hljs-keyword\">push<\/span><span class=\"hljs-preprocessor\">.sh<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6839\u636e\u6211\u4eec\u7684\u7ecf\u65b0\u4ed3\u5e93\u94fe\u63a5\u548c\u9700\u8981\u7684\u955c\u50cf\u7248\u672c\u53f7\u8c03\u6574\u811a\u672c\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-shebang\">#!\/bin\/bash<\/span>\n<span class=\"hljs-keyword\">set<\/span> -o errexit\n<span class=\"hljs-keyword\">set<\/span> -o nounset\n<span class=\"hljs-keyword\">set<\/span> -o pipefail\n\nKUBE_VERSION=v1.<span class=\"hljs-number\">11.2<\/span>\nKUBE_PAUSE_VERSION=<span class=\"hljs-number\">3.1<\/span>\nETCD_VERSION=<span class=\"hljs-number\">3.2<\/span>.<span class=\"hljs-number\">18<\/span>\nDNS_VERSION=<span class=\"hljs-number\">1.1<\/span>.<span class=\"hljs-number\">3<\/span>\n\nGCR_URL=gcr.io\/google-containers\nALIYUN_URL=registry.cn-qingdao.aliyuncs.com\/joe-k8s\/k8s\n\nimages=(kube-proxy-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\nkube-scheduler-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\nkube-controller-manager-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\nkube-apiserver-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\npause:<span class=\"hljs-variable\">${KUBE_PAUSE_VERSION}<\/span>\netcd-amd64:<span class=\"hljs-variable\">${ETCD_VERSION}<\/span>\ncoredns:<span class=\"hljs-variable\">${DNS_VERSION}<\/span>)\n\n<span class=\"hljs-keyword\">for<\/span> imageName <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-variable\">${images[@]}<\/span>\n<span class=\"hljs-keyword\">do<\/span>\n  docker pull <span class=\"hljs-variable\">$GCR_URL<\/span>\/<span class=\"hljs-variable\">$imageName<\/span>\n  docker tag <span class=\"hljs-variable\">$GCR_URL<\/span>\/<span class=\"hljs-variable\">$imageName<\/span> <span class=\"hljs-variable\">$ALIYUN_URL<\/span>\/<span class=\"hljs-variable\">$imageName<\/span>\n  docker push <span class=\"hljs-variable\">$ALIYUN_URL<\/span>\/<span class=\"hljs-variable\">$imageName<\/span>\n  docker rmi <span class=\"hljs-variable\">$ALIYUN_URL<\/span>\/<span class=\"hljs-variable\">$imageName<\/span>\n<span class=\"hljs-keyword\">done<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<li>26<\/li>\n<li>27<\/li>\n<li>28<\/li>\n<\/ul>\n<p>\u8fd0\u884cpush.sh<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">sh <span class=\"hljs-keyword\">push<\/span><span class=\"hljs-preprocessor\">.sh<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6210\u529f\u83b7\u53d6\u548cpush\u4e4b\u540e\u6211\u4eec\u7684\u955c\u50cf\u4ed3\u5e93registry.cn-qingdao.aliyuncs.com\/joe-k8s\/k8s\u4e2d\u5c31\u6709\u4e86\u76f8\u5173\u7684\u5305\u3002<\/p>\n<h4 id=\"\u65b9\u5f0f\u4e8c\u4f7f\u7528\u522b\u4eba\u5728\u56fd\u5185\u505a\u597d\u7684\u955c\u50cf\u4ed3\u5e93\">\u65b9\u5f0f\u4e8c\u4f7f\u7528\u522b\u4eba\u5728\u56fd\u5185\u505a\u597d\u7684\u955c\u50cf\u4ed3\u5e93<\/h4>\n<p>\u5982\u679c\u6ca1\u6709\u56fd\u5916\u7684\u670d\u52a1\u5668\u8282\u70b9\uff0c\u90a3\u6211\u4eec\u5c31\u4e0d\u80fd\u81ea\u7531\u7684\u5b9a\u5236\u9700\u8981\u7684\u7248\u672c\u53f7\u955c\u50cf\u4e86\u3002\u53ea\u80fd\u53bb\u627e\u627e\u522b\u4eba\u5df2\u7ecf\u505a\u597d\u7684\u955c\u50cf\u4ed3\u5e93\u4e2d\u6709\u54ea\u4e9b\u7248\u672c\uff0c\u662f\u5426\u6709\u5728\u66f4\u65b0\u3002<br \/>\n\u76ee\u524d\u505a\u7684\u6bd4\u8f83\u597d\u7684 \u6301\u7eed\u66f4\u65b0\u7684 k8s\u955c\u50cf\u4ed3\u5e93\u63a8\u8350 \u5b89\u5bb6\u7684\u3002<br \/>\n<a title=\"Google Container Registry(gcr.io) \u4e2d\u56fd\u53ef\u7528\u955c\u50cf(\u957f\u671f\u7ef4\u62a4)\" href=\"https:\/\/anjia0532.github.io\/2017\/11\/15\/gcr-io-image-mirror\/\" target=\"_blank\" rel=\"nofollow noopener\">Google Container Registry(gcr.io) \u4e2d\u56fd\u53ef\u7528\u955c\u50cf(\u957f\u671f\u7ef4\u62a4)<\/a><br \/>\n<a title=\"\u5b89\u5bb6\u7684github\" href=\"https:\/\/github.com\/anjia0532\/gcr.io_mirror\" target=\"_blank\" rel=\"nofollow noopener\">\u5b89\u5bb6\u7684github<\/a><br \/>\n<a title=\"\u955c\u50cf\u76ee\u5f55\" href=\"https:\/\/hub.docker.com\/u\/anjia0532\/\" target=\"_blank\" rel=\"nofollow noopener\">\u955c\u50cf\u76ee\u5f55<\/a><br \/>\n\u6211\u4eec\u5728\u955c\u50cf\u76ee\u5f55\u4e2d\u53ef\u4ee5\u770b\u5230 v1.11.2\u7248\u672c\u7684\u955c\u50cf\u4e5f\u662f\u6709\u4e86\u7684\uff0c\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n<p>\u8fd9\u91cc\u7684\u955c\u50cf\u76ee\u5f55<a href=\"https:\/\/hub.docker.com\/u\/anjia0532\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/hub.docker.com\/u\/anjia0532\/<\/a>\u4e0e\u6211\u4eec\u81ea\u5df1\u51c6\u5907\u7684\u955c\u50cf\u4ed3\u5e93registry.cn-qingdao.aliyuncs.com\/joe-k8s\/k8s \u662f\u540c\u7b49\u7684\u4f5c\u7528\uff0c\u4e0b\u9762\u4f1a\u7528\u5230\u3002<\/p>\n<h2 id=\"\u83b7\u53d6\u955c\u50cf\"><a name=\"t19\"><\/a>\u83b7\u53d6\u955c\u50cf<\/h2>\n<p>\u5728master\u8282\u70b9\u521b\u5efa\u83b7\u53d6\u7684\u811a\u672c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">vi pull<span class=\"hljs-preprocessor\">.sh<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6839\u636e\u81ea\u5df1\u7684\u955c\u50cf\u4ed3\u5e93\u83b7\u53d6\u5730\u5740\u8c03\u6574\u811a\u672c\uff0c\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-shebang\">#!\/bin\/bash<\/span>\nKUBE_VERSION=v1.<span class=\"hljs-number\">11.2<\/span>\nKUBE_PAUSE_VERSION=<span class=\"hljs-number\">3.1<\/span>\nETCD_VERSION=<span class=\"hljs-number\">3.2<\/span>.<span class=\"hljs-number\">18<\/span>\nDNS_VERSION=<span class=\"hljs-number\">1.1<\/span>.<span class=\"hljs-number\">3<\/span>\nusername=registry.cn-qingdao.aliyuncs.com\/joe-k8s\/k8s\n\nimages=(kube-proxy-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\nkube-scheduler-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\nkube-controller-manager-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\nkube-apiserver-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\npause:<span class=\"hljs-variable\">${KUBE_PAUSE_VERSION}<\/span>\netcd-amd64:<span class=\"hljs-variable\">${ETCD_VERSION}<\/span>\ncoredns:<span class=\"hljs-variable\">${DNS_VERSION}<\/span>\n    )\n\n<span class=\"hljs-keyword\">for<\/span> image <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-variable\">${images[@]}<\/span>\n<span class=\"hljs-keyword\">do<\/span>\n    docker pull <span class=\"hljs-variable\">${username}<\/span>\/<span class=\"hljs-variable\">${image}<\/span>\n    docker tag <span class=\"hljs-variable\">${username}<\/span>\/<span class=\"hljs-variable\">${image}<\/span> k8s.gcr.io\/<span class=\"hljs-variable\">${image}<\/span>\n    <span class=\"hljs-comment\">#docker tag ${username}\/${image} gcr.io\/google_containers\/${image}<\/span>\n    docker rmi <span class=\"hljs-variable\">${username}<\/span>\/<span class=\"hljs-variable\">${image}<\/span>\n<span class=\"hljs-keyword\">done<\/span>\n\n<span class=\"hljs-built_in\">unset<\/span> ARCH version images username<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<\/ul>\n<p>\u8fd0\u884c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">sh pull<span class=\"hljs-preprocessor\">.sh<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6ce8\u610f\uff0c\u5b89\u5bb6\u7684\u811a\u672c\u56e0\u4e3a\u4fee\u6539\u8fc7\u547d\u540d\u4f7f\u7528\u7684pull.sh\u811a\u672c\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-shebang\">#!\/bin\/bash<\/span>\nKUBE_VERSION=v1.<span class=\"hljs-number\">11.2<\/span>\nKUBE_PAUSE_VERSION=<span class=\"hljs-number\">3.1<\/span>\nETCD_VERSION=<span class=\"hljs-number\">3.2<\/span>.<span class=\"hljs-number\">18<\/span>\nDNS_VERSION=<span class=\"hljs-number\">1.1<\/span>.<span class=\"hljs-number\">3<\/span>\nusername=anjia0532\n\nimages=(google-containers.kube-proxy-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\ngoogle-containers.kube-scheduler-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\ngoogle-containers.kube-controller-manager-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\ngoogle-containers.kube-apiserver-amd64:<span class=\"hljs-variable\">${KUBE_VERSION}<\/span>\npause:<span class=\"hljs-variable\">${KUBE_PAUSE_VERSION}<\/span>\netcd-amd64:<span class=\"hljs-variable\">${ETCD_VERSION}<\/span>\ncoredns:<span class=\"hljs-variable\">${DNS_VERSION}<\/span>\n    )\n\n<span class=\"hljs-keyword\">for<\/span> image <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-variable\">${images[@]}<\/span>\n<span class=\"hljs-keyword\">do<\/span>\n    docker pull <span class=\"hljs-variable\">${username}<\/span>\/<span class=\"hljs-variable\">${image}<\/span>\n    docker tag <span class=\"hljs-variable\">${username}<\/span>\/<span class=\"hljs-variable\">${image}<\/span> k8s.gcr.io\/<span class=\"hljs-variable\">${image}<\/span>\n    <span class=\"hljs-comment\">#docker tag ${username}\/${image} gcr.io\/google_containers\/${image}<\/span>\n    docker rmi <span class=\"hljs-variable\">${username}<\/span>\/<span class=\"hljs-variable\">${image}<\/span>\n<span class=\"hljs-keyword\">done<\/span>\n\n<span class=\"hljs-built_in\">unset<\/span> ARCH version images username<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<\/ul>\n<p>\u68c0\u67e5\u955c\u50cf<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">docker images<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u53d1\u73b0\u5df2\u7ecf\u6709\u4e86\u9700\u8981\u7684\u955c\u50cf<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">[root@k8s ~]<span class=\"hljs-preprocessor\"># docker images<\/span>\nREPOSITORY                                                                 TAG                 IMAGE ID            CREATED             SIZE\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/google-containers<span class=\"hljs-preprocessor\">.kube<\/span>-apiserver-amd64                          v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">821507941e9<\/span>c        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">187<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/google-containers<span class=\"hljs-preprocessor\">.kube<\/span>-proxy-amd64                              v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">46<\/span>a3cd725628        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">97.8<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/google-containers<span class=\"hljs-preprocessor\">.kube<\/span>-controller-manager-amd64                 v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">38521457<\/span>c799        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">155<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/google-containers<span class=\"hljs-preprocessor\">.kube<\/span>-scheduler-amd64                          v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">37<\/span>a1403e6c1a        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">56.8<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/coredns                                                         <span class=\"hljs-number\">1.1<\/span><span class=\"hljs-number\">.3<\/span>               b3b94275d97c        <span class=\"hljs-number\">2<\/span> months ago        <span class=\"hljs-number\">45.6<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/etcd-amd64                                                      <span class=\"hljs-number\">3.2<\/span><span class=\"hljs-number\">.18<\/span>              b8df3b177be2        <span class=\"hljs-number\">4<\/span> months ago        <span class=\"hljs-number\">219<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/pause                                                           <span class=\"hljs-number\">3.1<\/span>                 da86e6ba6ca1        <span class=\"hljs-number\">7<\/span> months ago        <span class=\"hljs-number\">742<\/span> kB<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<\/ul>\n<p>\u6ce8\u610f \u8fd9\u91cc\u7684\u524d\u7f00\u9700\u8981\u4e0ekubeadm config images list\u65f6\u8f93\u51fa\u7684\u524d\u7f00\u5bf9\u5e94\uff0c\u5426\u5219init\u65f6\u4ecd\u7136\u4f1a\u8bc6\u522b\u4e0d\u5230\u53bb\u4e0b\u8f7d\u3002<br \/>\n\u6211\u4eec\u8fd9\u91cc\u662fk8s.gcr.io\u6240\u4ee5 \u811a\u672c\u4e2dpull \u65f6\u91cd\u547d\u540d\u4f7f\u7528\u7684\u662f<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\">docker tag <span class=\"hljs-variable\">${username}<\/span>\/<span class=\"hljs-variable\">${image}<\/span> k8s.gcr.io\/<span class=\"hljs-variable\">${image}<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f7f\u7528\u7684\u662fanjia0532\u7684\u7248\u672c\u5219\u8fd8\u9700\u8981\u8c03\u6574\u4e00\u904d\u547d\u540d\uff0c\u4f7f\u7528\u547d\u4ee4\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">docker <span class=\"hljs-built_in\">tag<\/span>  k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/google<span class=\"hljs-attribute\">-containers<\/span><span class=\"hljs-built_in\">.<\/span>kube<span class=\"hljs-attribute\">-apiserver<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>   k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/kube<span class=\"hljs-attribute\">-apiserver<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\ndocker <span class=\"hljs-built_in\">tag<\/span>  k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/google<span class=\"hljs-attribute\">-containers<\/span><span class=\"hljs-built_in\">.<\/span>kube<span class=\"hljs-attribute\">-controller<\/span><span class=\"hljs-attribute\">-manager<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>  k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/kube<span class=\"hljs-attribute\">-controller<\/span><span class=\"hljs-attribute\">-manager<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\ndocker <span class=\"hljs-built_in\">tag<\/span>  k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/google<span class=\"hljs-attribute\">-containers<\/span><span class=\"hljs-built_in\">.<\/span>kube<span class=\"hljs-attribute\">-scheduler<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>  k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/kube<span class=\"hljs-attribute\">-scheduler<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\ndocker <span class=\"hljs-built_in\">tag<\/span> k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/google<span class=\"hljs-attribute\">-containers<\/span><span class=\"hljs-built_in\">.<\/span>kube<span class=\"hljs-attribute\">-proxy<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>   k8s<span class=\"hljs-built_in\">.<\/span>gcr<span class=\"hljs-built_in\">.<\/span>io\/kube<span class=\"hljs-attribute\">-proxy<\/span><span class=\"hljs-attribute\">-amd64<\/span>:v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<p>\u51c6\u5907\u597d\u7684\u955c\u50cf\u5982\u4e0b,\u4e0ekubeadm config images list\u65f6\u8f93\u51fa\u7684\u955c\u50cf\u540d\u79f0\u7248\u672c\u4e00\u81f4\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">[root@k8s ~]<span class=\"hljs-preprocessor\"># docker images<\/span>\nREPOSITORY                                                                 TAG                 IMAGE ID            CREATED             SIZE\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-controller-manager-amd64                                   v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">38521457<\/span>c799        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">155<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-apiserver-amd64                                            v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">821507941e9<\/span>c        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">187<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-proxy-amd64                                                v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">46<\/span>a3cd725628        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">97.8<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/kube-scheduler-amd64                                            v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>             <span class=\"hljs-number\">37<\/span>a1403e6c1a        <span class=\"hljs-number\">6<\/span> days ago          <span class=\"hljs-number\">56.8<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/coredns                                                         <span class=\"hljs-number\">1.1<\/span><span class=\"hljs-number\">.3<\/span>               b3b94275d97c        <span class=\"hljs-number\">2<\/span> months ago        <span class=\"hljs-number\">45.6<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/etcd-amd64                                                      <span class=\"hljs-number\">3.2<\/span><span class=\"hljs-number\">.18<\/span>              b8df3b177be2        <span class=\"hljs-number\">4<\/span> months ago        <span class=\"hljs-number\">219<\/span> MB\nk8s<span class=\"hljs-preprocessor\">.gcr<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/pause                                                           <span class=\"hljs-number\">3.1<\/span>                 da86e6ba6ca1        <span class=\"hljs-number\">7<\/span> months ago        <span class=\"hljs-number\">742<\/span> kB<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<\/ul>\n<h2 id=\"\u4f7f\u7528kubeadm-init\u521d\u59cb\u5316\u96c6\u7fa4-\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c\"><a name=\"t20\"><\/a>\u4f7f\u7528kubeadm init\u521d\u59cb\u5316\u96c6\u7fa4 (\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c)<\/h2>\n<p>\u521d\u59cb\u5316\u524d\u786e\u8ba4 kubelet\u542f\u52a8\u548c cgroup-driver\u7b49\u65b9\u5f0f\u662f\u5426\u5bf9\u5e94\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u4f7f\u7528kubeadm\u521d\u59cb\u5316\u96c6\u7fa4\uff0c\u9009\u62e9k8s\u4f5c\u4e3aMaster Node<br \/>\n\u786e\u4fdd\u6ca1\u6709\u8bbe\u7f6ehttp_proxy\u548chttps_proxy\u4ee3\u7406<br \/>\n\u5728k8s\u4e0a\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">kubeadm init   <span class=\"hljs-subst\">--<\/span>kubernetes<span class=\"hljs-attribute\">-version<\/span><span class=\"hljs-subst\">=<\/span>v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>   <span class=\"hljs-subst\">--<\/span>pod<span class=\"hljs-attribute\">-network<\/span><span class=\"hljs-attribute\">-cidr<\/span><span class=\"hljs-subst\">=<\/span><span class=\"hljs-number\">10.244<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.0<\/span>\/<span class=\"hljs-number\">16<\/span>   <span class=\"hljs-subst\">--<\/span>apiserver<span class=\"hljs-attribute\">-advertise<\/span><span class=\"hljs-attribute\">-address<\/span><span class=\"hljs-subst\">=<\/span><span class=\"hljs-number\">192.168<\/span><span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.90<\/span> <span class=\"hljs-subst\">--<\/span>token<span class=\"hljs-attribute\">-ttl<\/span> <span class=\"hljs-number\">0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u2013kubernetes-version\u6839\u636e\u4e0a\u9762\u5b89\u88c5\u6210\u529f\u65f6\u7684\u63d0\u793a:kubectl.x86_64 0:1.11.2-0\u5bf9\u5e94\u7248\u672c\u3002<br \/>\n\u56e0\u4e3a\u6211\u4eec\u9009\u62e9flannel\u4f5c\u4e3aPod\u7f51\u7edc\u63d2\u4ef6\uff0c\u6240\u4ee5\u4e0a\u9762\u7684\u547d\u4ee4\u6307\u5b9a\u2013pod-network-cidr=10.244.0.0\/16\u3002<br \/>\n\u5bf9\u4e8e\u67d0\u4e9b\u7f51\u7edc\u89e3\u51b3\u65b9\u6848\uff0cKubernetes master \u4e5f\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u8282\u70b9\u5206\u914d\u7f51\u7edc\u8303\u56f4\uff08CIDR\uff09\uff0c\u8fd9\u5305\u62ec\u4e00\u4e9b\u4e91\u63d0\u4f9b\u5546\u548c flannel\u3002\u901a\u8fc7 \u2013pod-network-cidr \u53c2\u6570\u6307\u5b9a\u7684\u5b50\u7f51\u8303\u56f4\u5c06\u88ab\u5206\u89e3\u5e76\u53d1\u9001\u7ed9\u6bcf\u4e2a node\u3002\u8fd9\u4e2a\u8303\u56f4\u5e94\u8be5\u4f7f\u7528\u6700\u5c0f\u7684 \/16\uff0c\u4ee5\u8ba9 controller-manager \u80fd\u591f\u7ed9\u96c6\u7fa4\u4e2d\u7684\u6bcf\u4e2a node \u5206\u914d \/24 \u7684\u5b50\u7f51\u3002\u5982\u679c\u6211\u4eec\u662f\u901a\u8fc7 \u8fd9\u4e2a manifest \u6587\u4ef6\u6765\u4f7f\u7528 flannel\uff0c\u90a3\u4e48\u60a8\u5e94\u8be5\u4f7f\u7528 \u2013pod-network-cidr=10.244.0.0\/16\u3002\u5927\u90e8\u5206\u57fa\u4e8e CNI \u7684\u7f51\u7edc\u89e3\u51b3\u65b9\u6848\u90fd\u4e0d\u9700\u8981\u8fd9\u4e2a\u53c2\u6570\u3002<br \/>\n\u2013apiserver-advertise-address\u662fapiserver\u7684\u901a\u4fe1\u5730\u5740\uff0c\u4e00\u822c\u4f7f\u7528master\u7684ip\u5730\u5740\u3002<\/p>\n<p>\u901a\u8fc7kubeadm\u521d\u59cb\u5316\u540e\uff0c\u90fd\u4f1a\u63d0\u4f9b\u8282\u70b9\u52a0\u5165k8s\u96c6\u7fa4\u7684token\u3002\u9ed8\u8ba4token\u7684\u6709\u6548\u671f\u4e3a24\u5c0f\u65f6\uff0c\u5f53\u8fc7\u671f\u4e4b\u540e\uff0c\u8be5token\u5c31\u4e0d\u53ef\u7528\u4e86\uff0c\u9700\u8981\u91cd\u65b0\u751f\u6210token\uff0c\u4f1a\u6bd4\u8f83\u9ebb\u70e6\uff0c\u8fd9\u91cc\u2013token-ttl\u8bbe\u7f6e\u4e3a0\u8868\u793a\u6c38\u4e0d\u8fc7\u671f\u3002<br \/>\ntoken\u8fc7\u671f\u540e\u91cd\u65b0\u521b\u5efatoken\u7684\u65b9\u6cd5\u770b\u6587\u672b\u3002<\/p>\n<h3 id=\"\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898-\u5361\u5728preflightimages\"><a name=\"t21\"><\/a>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898-\u5361\u5728preflight\/images<\/h3>\n<p>init\u8fc7\u7a0b\u4e2dkubernetes\u4f1a\u81ea\u52a8\u4ecegoogle\u670d\u52a1\u5668\u4e2d\u4e0b\u8f7d\u76f8\u5173\u7684docker\u955c\u50cf<br \/>\nkubeadm init\u8fc7\u7a0b\u9996\u5148\u4f1a\u68c0\u67e5\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u786e\u5b9a\u8ddf kube-apiserver \u7684 https \u8fde\u63a5\u65b9\u5f0f\uff0c\u5982\u679c\u6709\u4ee3\u7406\u8bbe\u7f6e\uff0c\u4f1a\u63d0\u51fa\u8b66\u544a\u3002<br \/>\n\u5982\u679c\u4e00\u76f4\u5361\u5728preflight\/images<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vbnet has-numbering\">[preflight\/images] Pulling images required <span class=\"hljs-keyword\">for<\/span> setting up a Kubernetes cluster\n[preflight\/images] This might <span class=\"hljs-keyword\">take<\/span> a minute <span class=\"hljs-keyword\">or<\/span> two, depending <span class=\"hljs-keyword\">on<\/span> the speed <span class=\"hljs-keyword\">of<\/span> your internet connection\n[preflight\/images] You can also perform this action <span class=\"hljs-keyword\">in<\/span> beforehand <span class=\"hljs-keyword\">using<\/span> <span class=\"hljs-comment\">'kubeadm config images pull'<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u8bf7\u67e5\u770b\u4e0a\u4e00\u5c0f\u8282\uff0c\u5148\u51c6\u5907\u76f8\u5173\u955c\u50cf\u3002<\/p>\n<h3 id=\"\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898-uses-proxy\"><a name=\"t22\"><\/a>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898-uses proxy<\/h3>\n<p>\u5982\u679c\u62a5\u9519<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs applescript has-numbering\">    [WARNING HTTPProxy]: Connection <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-string\">\"https:\/\/192.168.11.90\"<\/span> uses proxy <span class=\"hljs-string\">\"http:\/\/127.0.0.1:8118\"<\/span>. If <span class=\"hljs-keyword\">that<\/span> <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-keyword\">not<\/span> intended, adjust your proxy settings\n    [WARNING HTTPProxyCIDR]: connection <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-string\">\"10.96.0.0\/12\"<\/span> uses proxy <span class=\"hljs-string\">\"http:\/\/127.0.0.1:8118\"<\/span>. This may lead <span class=\"hljs-keyword\">to<\/span> malfunctional cluster setup. Make sure <span class=\"hljs-keyword\">that<\/span> Pod <span class=\"hljs-keyword\">and<\/span> Services IP ranges specified correctly <span class=\"hljs-keyword\">as<\/span> exceptions <span class=\"hljs-keyword\">in<\/span> proxy configuration\n    [WARNING HTTPProxyCIDR]: connection <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-string\">\"10.244.0.0\/16\"<\/span> uses proxy <span class=\"hljs-string\">\"http:\/\/127.0.0.1:8118\"<\/span>. This may lead <span class=\"hljs-keyword\">to<\/span> malfunctional cluster setup. Make sure <span class=\"hljs-keyword\">that<\/span> Pod <span class=\"hljs-keyword\">and<\/span> Services IP ranges specified correctly <span class=\"hljs-keyword\">as<\/span> exceptions <span class=\"hljs-keyword\">in<\/span> proxy configuration<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u5219\u8bbe\u7f6eno_proxy<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">vi \/etc\/profile<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5728\u6700\u540e\u6dfb\u52a0<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-keyword\">export<\/span> no_proxy=<span class=\"hljs-string\">'anjia0532,127.0.0.1,192.168.11.90,k8s.gcr.io,10.96.0.0\/12,10.244.0.0\/16'<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u4f7f\u7528\u547d\u4ee4\u8ba9\u914d\u7f6e\u751f\u6548<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">source<\/span> \/etc\/profile<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u66f4\u591ainit\u7684\u9519\u8bef\u53ef\u4ee5\u65b0\u5f00\u4e00\u4e2a\u63a7\u5236\u53f0\u4f7f\u7528\u547d\u4ee4\u8ddf\u8e2a:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">journalctl <span class=\"hljs-attribute\">-f<\/span> <span class=\"hljs-attribute\">-u<\/span> kubelet<span class=\"hljs-built_in\">.<\/span>service<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u67e5\u770b\u5177\u4f53\u7684\u5361\u4f4f\u539f\u56e0\u3002<\/p>\n<h3 id=\"\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898-failed-to-read-kubelet-config-file-varlibkubeletconfigyaml\"><a name=\"t23\"><\/a>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898-failed to read kubelet config file \u201c\/var\/lib\/kubelet\/config.yaml\u201d<\/h3>\n<pre class=\"prettyprint\"><code class=\"hljs livecodeserver has-numbering\"><span class=\"hljs-number\">8<\/span>\u6708 <span class=\"hljs-number\">14<\/span> <span class=\"hljs-number\">20<\/span>:<span class=\"hljs-number\">44<\/span>:<span class=\"hljs-number\">42<\/span> k8s systemd[<span class=\"hljs-number\">1<\/span>]: kubelet.service holdoff <span class=\"hljs-built_in\">time<\/span> over, scheduling restart.\n<span class=\"hljs-number\">8<\/span>\u6708 <span class=\"hljs-number\">14<\/span> <span class=\"hljs-number\">20<\/span>:<span class=\"hljs-number\">44<\/span>:<span class=\"hljs-number\">42<\/span> k8s systemd[<span class=\"hljs-number\">1<\/span>]: Started kubelet: The Kubernetes Node Agent.\n<span class=\"hljs-number\">8<\/span>\u6708 <span class=\"hljs-number\">14<\/span> <span class=\"hljs-number\">20<\/span>:<span class=\"hljs-number\">44<\/span>:<span class=\"hljs-number\">42<\/span> k8s systemd[<span class=\"hljs-number\">1<\/span>]: Starting kubelet: The Kubernetes Node Agent...\n<span class=\"hljs-number\">8<\/span>\u6708 <span class=\"hljs-number\">14<\/span> <span class=\"hljs-number\">20<\/span>:<span class=\"hljs-number\">44<\/span>:<span class=\"hljs-number\">42<\/span> k8s kubelet[<span class=\"hljs-number\">5471<\/span>]: F0814 <span class=\"hljs-number\">20<\/span>:<span class=\"hljs-number\">44<\/span>:<span class=\"hljs-number\">42.477878<\/span>    <span class=\"hljs-number\">5471<\/span> server.go:<span class=\"hljs-number\">190<\/span>] failed <span class=\"hljs-built_in\">to<\/span> <span class=\"hljs-built_in\">load<\/span> Kubelet config <span class=\"hljs-built_in\">file<\/span> \/var\/lib\/kubelet\/config.yaml, error failed <span class=\"hljs-built_in\">to<\/span> <span class=\"hljs-built_in\">read<\/span> kubelet config <span class=\"hljs-built_in\">file<\/span> <span class=\"hljs-string\">\"\/var\/lib\/kubelet\/config.yaml\"<\/span>, error: <span class=\"hljs-built_in\">open<\/span> \/var\/lib\/kubelet\/config.yaml: no such <span class=\"hljs-built_in\">file<\/span> <span class=\"hljs-operator\">or<\/span> <span class=\"hljs-built_in\">directory<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<p>\u539f\u56e0<br \/>\n\u5173\u952e\u6587\u4ef6\u7f3a\u5931\uff0c\u591a\u53d1\u751f\u4e8e\u6ca1\u6709\u505a kubeadm init\u5c31\u8fd0\u884c\u4e86systemctl start kubelet\u3002<br \/>\n\u89e3\u51b3\u65b9\u6cd5<br \/>\n\u5148\u6210\u529f\u8fd0\u884ckubeadm init\u3002<\/p>\n<h3 id=\"\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898cni-config-uninitialized\"><a name=\"t24\"><\/a>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u2013cni config uninitialized<\/h3>\n<pre class=\"prettyprint\"><code class=\"hljs vbnet has-numbering\">KubeletNotReady runtime network <span class=\"hljs-keyword\">not<\/span> ready: NetworkReady=<span class=\"hljs-literal\">false<\/span> reason:NetworkPluginNotReady message:docker: network plugin <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-keyword\">not<\/span> ready: cni config uninitialized<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u539f\u56e0<br \/>\n\u56e0\u4e3akubelet\u914d\u7f6e\u4e86network-plugin=cni\uff0c\u4f46\u662f\u8fd8\u6ca1\u5b89\u88c5\uff0c\u6240\u4ee5\u72b6\u6001\u4f1a\u662fNotReady,\u4e0d\u60f3\u770b\u8fd9\u4e2a\u62a5\u9519\u6216\u8005\u4e0d\u9700\u8981\u7f51\u7edc\uff0c\u5c31\u53ef\u4ee5\u4fee\u6539kubelet\u914d\u7f6e\u6587\u4ef6\uff0c\u53bb\u6389network-plugin=cni \u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\n\u89e3\u51b3\u65b9\u6cd5<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">vi \/etc\/systemd\/system\/kubelet<span class=\"hljs-preprocessor\">.service<\/span><span class=\"hljs-preprocessor\">.d<\/span>\/<span class=\"hljs-number\">10<\/span>-kubeadm<span class=\"hljs-preprocessor\">.conf<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5220\u9664\u6700\u540e\u4e00\u884c\u91cc\u7684$KUBELET_NETWORK_ARGS<br \/>\n1.11.2\u7248\u672c\u7684\u5c01\u88c5\u5728\/var\/lib\/kubelet\/kubeadm-flags.env\u6587\u4ef6\u4e2d<br \/>\n\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ruby has-numbering\">[root<span class=\"hljs-variable\">@k8s<\/span> ~]<span class=\"hljs-comment\"># cat \/var\/lib\/kubelet\/kubeadm-flags.env<\/span>\n<span class=\"hljs-constant\">KUBELET_KUBEADM_ARGS<\/span>=--cgroup-driver=systemd --cni-bin-dir=<span class=\"hljs-regexp\">\/opt\/cni<\/span><span class=\"hljs-regexp\">\/bin --cni-conf-dir=\/etc<\/span><span class=\"hljs-regexp\">\/cni\/net<\/span>.d --network-plugin=cni<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u91cd\u542fkubelet<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs sql has-numbering\">systemctl enable kubelet &amp;&amp; systemctl <span class=\"hljs-operator\"><span class=\"hljs-keyword\">start<\/span> kubelet<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u91cd\u65b0\u521d\u59cb\u5316<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">kubeadm reset\nkubeadm init   <span class=\"hljs-subst\">--<\/span>kubernetes<span class=\"hljs-attribute\">-version<\/span><span class=\"hljs-subst\">=<\/span>v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>   <span class=\"hljs-subst\">--<\/span>pod<span class=\"hljs-attribute\">-network<\/span><span class=\"hljs-attribute\">-cidr<\/span><span class=\"hljs-subst\">=<\/span><span class=\"hljs-number\">10.244<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.0<\/span>\/<span class=\"hljs-number\">16<\/span>   <span class=\"hljs-subst\">--<\/span>apiserver<span class=\"hljs-attribute\">-advertise<\/span><span class=\"hljs-attribute\">-address<\/span><span class=\"hljs-subst\">=<\/span><span class=\"hljs-number\">192.168<\/span><span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.90<\/span> <span class=\"hljs-subst\">--<\/span>token<span class=\"hljs-attribute\">-ttl<\/span> <span class=\"hljs-number\">0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u6b63\u786e\u521d\u59cb\u5316\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vhdl has-numbering\">[root@k8s ~]# kubeadm init   <span class=\"hljs-comment\">--kubernetes-version=v1.11.2   --pod-network-cidr=10.244.0.0\/16   --apiserver-advertise-address=192.168.11.90 --token-ttl 0<\/span>\n[init] using Kubernetes version: v1<span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.2<\/span>\n[preflight] running pre-flight checks\nI0815 <span class=\"hljs-number\">16<\/span>:<span class=\"hljs-number\">24<\/span>:<span class=\"hljs-number\">34.651252<\/span>   <span class=\"hljs-number\">21183<\/span> kernel_validator.go:<span class=\"hljs-number\">81<\/span>] Validating kernel version\nI0815 <span class=\"hljs-number\">16<\/span>:<span class=\"hljs-number\">24<\/span>:<span class=\"hljs-number\">34.651356<\/span>   <span class=\"hljs-number\">21183<\/span> kernel_validator.go:<span class=\"hljs-number\">96<\/span>] Validating kernel config\n[preflight\/images] Pulling images required <span class=\"hljs-keyword\">for<\/span> setting up a Kubernetes cluster\n[preflight\/images] This might take a minute <span class=\"hljs-keyword\">or<\/span> two, depending <span class=\"hljs-keyword\">on<\/span> the speed <span class=\"hljs-keyword\">of<\/span> your internet connection\n[preflight\/images] You can also perform this action <span class=\"hljs-keyword\">in<\/span> beforehand using <span class=\"hljs-attribute\">'kubeadm<\/span> config images pull'\n[kubelet] Writing kubelet environment <span class=\"hljs-keyword\">file<\/span> <span class=\"hljs-keyword\">with<\/span> flags <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-keyword\">file<\/span> <span class=\"hljs-string\">\"\/var\/lib\/kubelet\/kubeadm-flags.env\"<\/span>\n[kubelet] Writing kubelet <span class=\"hljs-keyword\">configuration<\/span> <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-keyword\">file<\/span> <span class=\"hljs-string\">\"\/var\/lib\/kubelet\/config.yaml\"<\/span>\n[preflight] Activating the kubelet service\n[certificates] Generated ca certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] Generated apiserver certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] apiserver serving cert <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-typename\">signed<\/span> <span class=\"hljs-keyword\">for<\/span> DNS names [k8s kubernetes kubernetes.<span class=\"hljs-keyword\">default<\/span> kubernetes.<span class=\"hljs-keyword\">default<\/span>.svc kubernetes.<span class=\"hljs-keyword\">default<\/span>.svc.cluster.local] <span class=\"hljs-keyword\">and<\/span> IPs [<span class=\"hljs-number\">10.96<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.1<\/span> <span class=\"hljs-number\">192.168<\/span><span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.90<\/span>]\n[certificates] Generated apiserver-kubelet-client certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] Generated sa key <span class=\"hljs-keyword\">and<\/span> public key.\n[certificates] Generated front-proxy-ca certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] Generated front-proxy-client certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] Generated etcd\/ca certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] Generated etcd\/server certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] etcd\/server serving cert <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-typename\">signed<\/span> <span class=\"hljs-keyword\">for<\/span> DNS names [k8s localhost] <span class=\"hljs-keyword\">and<\/span> IPs [<span class=\"hljs-number\">127.0<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.1<\/span> ::<span class=\"hljs-number\">1<\/span>]\n[certificates] Generated etcd\/peer certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] etcd\/peer serving cert <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-typename\">signed<\/span> <span class=\"hljs-keyword\">for<\/span> DNS names [k8s localhost] <span class=\"hljs-keyword\">and<\/span> IPs [<span class=\"hljs-number\">192.168<\/span><span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.90<\/span> <span class=\"hljs-number\">127.0<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.1<\/span> ::<span class=\"hljs-number\">1<\/span>]\n[certificates] Generated etcd\/healthcheck-client certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] Generated apiserver-etcd-client certificate <span class=\"hljs-keyword\">and<\/span> key.\n[certificates] valid certificates <span class=\"hljs-keyword\">and<\/span> keys now exist <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-string\">\"\/etc\/kubernetes\/pki\"<\/span>\n[kubeconfig] Wrote KubeConfig <span class=\"hljs-keyword\">file<\/span> <span class=\"hljs-keyword\">to<\/span> disk: <span class=\"hljs-string\">\"\/etc\/kubernetes\/admin.conf\"<\/span>\n[kubeconfig] Wrote KubeConfig <span class=\"hljs-keyword\">file<\/span> <span class=\"hljs-keyword\">to<\/span> disk: <span class=\"hljs-string\">\"\/etc\/kubernetes\/kubelet.conf\"<\/span>\n[kubeconfig] Wrote KubeConfig <span class=\"hljs-keyword\">file<\/span> <span class=\"hljs-keyword\">to<\/span> disk: <span class=\"hljs-string\">\"\/etc\/kubernetes\/controller-manager.conf\"<\/span>\n[kubeconfig] Wrote KubeConfig <span class=\"hljs-keyword\">file<\/span> <span class=\"hljs-keyword\">to<\/span> disk: <span class=\"hljs-string\">\"\/etc\/kubernetes\/scheduler.conf\"<\/span>\n[controlplane] wrote Static Pod manifest <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-keyword\">component<\/span> kube-apiserver <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-string\">\"\/etc\/kubernetes\/manifests\/kube-apiserver.yaml\"<\/span>\n[controlplane] wrote Static Pod manifest <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-keyword\">component<\/span> kube-controller-manager <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-string\">\"\/etc\/kubernetes\/manifests\/kube-controller-manager.yaml\"<\/span>\n[controlplane] wrote Static Pod manifest <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-keyword\">component<\/span> kube-scheduler <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-string\">\"\/etc\/kubernetes\/manifests\/kube-scheduler.yaml\"<\/span>\n[etcd] Wrote Static Pod manifest <span class=\"hljs-keyword\">for<\/span> a local etcd instance <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-string\">\"\/etc\/kubernetes\/manifests\/etcd.yaml\"<\/span>\n[init] waiting <span class=\"hljs-keyword\">for<\/span> the kubelet <span class=\"hljs-keyword\">to<\/span> boot up the control plane as Static Pods from directory <span class=\"hljs-string\">\"\/etc\/kubernetes\/manifests\"<\/span>\n[init] this might take a minute <span class=\"hljs-keyword\">or<\/span> longer <span class=\"hljs-keyword\">if<\/span> the control plane images have <span class=\"hljs-keyword\">to<\/span> be pulled\n[apiclient] <span class=\"hljs-keyword\">All<\/span> control plane components are healthy <span class=\"hljs-keyword\">after<\/span> <span class=\"hljs-number\">40.004083<\/span> seconds\n[uploadconfig] storing the <span class=\"hljs-keyword\">configuration<\/span> used <span class=\"hljs-keyword\">in<\/span> ConfigMap <span class=\"hljs-string\">\"kubeadm-config\"<\/span> <span class=\"hljs-keyword\">in<\/span> the <span class=\"hljs-string\">\"kube-system\"<\/span> Namespace\n[kubelet] Creating a ConfigMap <span class=\"hljs-string\">\"kubelet-config-1.11\"<\/span> <span class=\"hljs-keyword\">in<\/span> namespace kube-system <span class=\"hljs-keyword\">with<\/span> the <span class=\"hljs-keyword\">configuration<\/span> <span class=\"hljs-keyword\">for<\/span> the kubelets <span class=\"hljs-keyword\">in<\/span> the cluster\n[markmaster] Marking the node k8s as master by adding the <span class=\"hljs-keyword\">label<\/span> <span class=\"hljs-string\">\"node-role.kubernetes.io\/master=''\"<\/span>\n[markmaster] Marking the node k8s as master by adding the taints [node-role.kubernetes.io\/master:NoSchedule]\n[patchnode] Uploading the CRI Socket information <span class=\"hljs-string\">\"\/var\/run\/dockershim.sock\"<\/span> <span class=\"hljs-keyword\">to<\/span> the Node API object <span class=\"hljs-string\">\"k8s\"<\/span> as an annotation\n[bootstraptoken] using token: hu2clf<span class=\"hljs-number\">.898<\/span>he8fnu64w3fur\n[bootstraptoken] configured RBAC rules <span class=\"hljs-keyword\">to<\/span> allow Node Bootstrap tokens <span class=\"hljs-keyword\">to<\/span> post CSRs <span class=\"hljs-keyword\">in<\/span> order <span class=\"hljs-keyword\">for<\/span> nodes <span class=\"hljs-keyword\">to<\/span> get long term certificate credentials\n[bootstraptoken] configured RBAC rules <span class=\"hljs-keyword\">to<\/span> allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token\n[bootstraptoken] configured RBAC rules <span class=\"hljs-keyword\">to<\/span> allow certificate rotation <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-keyword\">all<\/span> node client certificates <span class=\"hljs-keyword\">in<\/span> the cluster\n[bootstraptoken] creating the <span class=\"hljs-string\">\"cluster-info\"<\/span> ConfigMap <span class=\"hljs-keyword\">in<\/span> the <span class=\"hljs-string\">\"kube-public\"<\/span> namespace\n[addons] Applied essential addon: CoreDNS\n[addons] Applied essential addon: kube-proxy\n\nYour Kubernetes master has initialized successfully!\n\n<span class=\"hljs-keyword\">To<\/span> start using your cluster, you need <span class=\"hljs-keyword\">to<\/span> run the following as a regular user:\n\n  mkdir -p $HOME\/.kube\n  sudo cp -i \/etc\/kubernetes\/admin.conf $HOME\/.kube\/config\n  sudo chown $(id -u):$(id -g) $HOME\/.kube\/config\n\nYou should now deploy a pod network <span class=\"hljs-keyword\">to<\/span> the cluster.\nRun <span class=\"hljs-string\">\"kubectl apply -f [podnetwork].yaml\"<\/span> <span class=\"hljs-keyword\">with<\/span> one <span class=\"hljs-keyword\">of<\/span> the options listed at:\n  https:\/\/kubernetes.io\/docs\/concepts\/cluster-administration\/addons\/\n\nYou can now join any number <span class=\"hljs-keyword\">of<\/span> machines by running the following <span class=\"hljs-keyword\">on<\/span> each node\nas root:\n\n  kubeadm join <span class=\"hljs-number\">192.168<\/span><span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.90<\/span>:<span class=\"hljs-number\">6443<\/span> <span class=\"hljs-comment\">--token hu2clf.898he8fnu64w3fur --discovery-token-ca-cert-hash sha256:2a196bbd77e4152a700d294a666e9d97336d0f7097f55e19a651c19e03d340a4<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<li>26<\/li>\n<li>27<\/li>\n<li>28<\/li>\n<li>29<\/li>\n<li>30<\/li>\n<li>31<\/li>\n<li>32<\/li>\n<li>33<\/li>\n<li>34<\/li>\n<li>35<\/li>\n<li>36<\/li>\n<li>37<\/li>\n<li>38<\/li>\n<li>39<\/li>\n<li>40<\/li>\n<li>41<\/li>\n<li>42<\/li>\n<li>43<\/li>\n<li>44<\/li>\n<li>45<\/li>\n<li>46<\/li>\n<li>47<\/li>\n<li>48<\/li>\n<li>49<\/li>\n<li>50<\/li>\n<li>51<\/li>\n<li>52<\/li>\n<li>53<\/li>\n<li>54<\/li>\n<li>55<\/li>\n<li>56<\/li>\n<li>57<\/li>\n<li>58<\/li>\n<li>59<\/li>\n<li>60<\/li>\n<li>61<\/li>\n<li>62<\/li>\n<li>63<\/li>\n<li>64<\/li>\n<li>65<\/li>\n<li>66<\/li>\n<\/ul>\n<p>\u4e0a\u9762\u8bb0\u5f55\u4e86\u5b8c\u6210\u7684\u521d\u59cb\u5316\u8f93\u51fa\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u5176\u4e2d\u6709\u4ee5\u4e0b\u5173\u952e\u5185\u5bb9\uff1a<br \/>\n\u751f\u6210token\u8bb0\u5f55\u4e0b\u6765\uff0c\u540e\u8fb9\u4f7f\u7528kubeadm join\u5f80\u96c6\u7fa4\u4e2d\u6dfb\u52a0\u8282\u70b9\u65f6\u4f1a\u7528\u5230<br \/>\n\u4e0b\u9762\u7684\u547d\u4ee4\u662f\u914d\u7f6e\u5e38\u89c4\u7528\u6237\u5982\u4f55\u4f7f\u7528kubectl(\u5ba2\u6237\u7aef)\u8bbf\u95ee\u96c6\u7fa4,\u56e0\u4e3amaster\u8282\u70b9\u4e5f\u9700\u8981\u4f7f\u7528kubectl\u8bbf\u95ee\u96c6\u7fa4\uff0c\u6240\u4ee5\u4e5f\u9700\u8981\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">  mkdir <span class=\"hljs-attribute\">-p<\/span> <span class=\"hljs-variable\">$HOME<\/span><span class=\"hljs-subst\">\/<\/span><span class=\"hljs-built_in\">.<\/span>kube\n  sudo cp <span class=\"hljs-attribute\">-i<\/span> \/etc\/kubernetes\/admin<span class=\"hljs-built_in\">.<\/span>conf <span class=\"hljs-variable\">$HOME<\/span><span class=\"hljs-subst\">\/<\/span><span class=\"hljs-built_in\">.<\/span>kube\/config\n  sudo chown $(id <span class=\"hljs-attribute\">-u<\/span>):$(id <span class=\"hljs-attribute\">-g<\/span>) <span class=\"hljs-variable\">$HOME<\/span><span class=\"hljs-subst\">\/<\/span><span class=\"hljs-built_in\">.<\/span>kube\/config<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<p>\u6700\u540e\u7ed9\u51fa\u4e86\u5c06\u8282\u70b9\u52a0\u5165\u96c6\u7fa4\u7684\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">kubeadm <span class=\"hljs-keyword\">join<\/span> <span class=\"hljs-number\">192.168<\/span><span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.90<\/span>:<span class=\"hljs-number\">6443<\/span> <span class=\"hljs-subst\">--<\/span>token hu2clf<span class=\"hljs-number\">.898<\/span>he8fnu64w3fur <span class=\"hljs-subst\">--<\/span>discovery<span class=\"hljs-attribute\">-token<\/span><span class=\"hljs-attribute\">-ca<\/span><span class=\"hljs-attribute\">-cert<\/span><span class=\"hljs-attribute\">-hash<\/span> sha256:<span class=\"hljs-number\">2<\/span>a196bbd77e4152a700d294a666e9d97336d0f7097f55e19a651c19e03d340a4<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u67e5\u770b\u4e00\u4e0b\u96c6\u7fa4\u72b6\u6001\u5982\u4e0b\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs erlang-repl has-numbering\"><span class=\"hljs-function_or_atom\">kubectl<\/span> <span class=\"hljs-function_or_atom\">get<\/span> <span class=\"hljs-function_or_atom\">cs<\/span>\n<span class=\"hljs-variable\">NAME<\/span>                 <span class=\"hljs-variable\">STATUS<\/span>    <span class=\"hljs-variable\">MESSAGE<\/span>              <span class=\"hljs-variable\">ERROR<\/span>\n<span class=\"hljs-function_or_atom\">scheduler<\/span>            <span class=\"hljs-variable\">Healthy<\/span>   <span class=\"hljs-ok\">ok<\/span>\n<span class=\"hljs-function_or_atom\">controller<\/span>-<span class=\"hljs-function_or_atom\">manager<\/span>   <span class=\"hljs-variable\">Healthy<\/span>   <span class=\"hljs-ok\">ok<\/span>\n<span class=\"hljs-function_or_atom\">etcd<\/span>-<span class=\"hljs-number\">0<\/span>               <span class=\"hljs-variable\">Healthy<\/span>   {<span class=\"hljs-string\">\"health\"<\/span>: <span class=\"hljs-string\">\"true\"<\/span>}<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<\/ul>\n<p>\u786e\u8ba4\u6bcf\u4e2a\u7ec4\u4ef6\u90fd\u5904\u4e8ehealthy\u72b6\u6001\u3002<\/p>\n<h3 id=\"\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898nethttp-tls-handshake-timeout\"><a name=\"t25\"><\/a>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u2013net\/http: TLS handshake timeout<\/h3>\n<p>\u5982\u679c\u62a5\u9519\u4e3b\u8282\u70b9\u76846443\u7aef\u53e3\u65e0\u6cd5\u8fde\u63a5\uff0c\u8d85\u65f6\uff0c\u62d2\u7edd\u8fde\u63a5\u3002\u9700\u8981\u68c0\u67e5\u7f51\u7edc\uff0c\u4e00\u822c\u6765\u8bf4 \u662f\u56e0\u6211\u4eec\u6211\u4eec\u8bbe\u7f6e\u4e86http_proxy\u548chttps_proxy\u505a\u4ee3\u7406\u7ffb\u5899\u5bfc\u81f4\u4e0d\u80fd\u8bbf\u95ee\u81ea\u8eab\u548c\u5185\u7f51\u3002<br \/>\n\u9700\u8981\u5728\/etc\/profile\u4e2d\u589e\u52a0no_proxy\u53c2\u6570\u540e\u91cd\u8bd5\uff0c\u6216\u8005\u91cd\u65b0init\u3002<br \/>\n\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">vi \/etc\/profile<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5728\u6700\u540e\u589e\u52a0<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-keyword\">export<\/span> no_proxy=<span class=\"hljs-string\">'anjia0532,127.0.0.1,192.168.11.90,192.168.11.91,192.168.11.92,k8s.gcr.io,10.96.0.0\/12,10.244.0.0\/16,localhost'<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u4fdd\u5b58\u9000\u51fa\u3002<br \/>\n\u8ba9\u914d\u7f6e\u751f\u6548<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-built_in\">source<\/span> \/etc\/profile<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5982\u679c\u4ecd\u7136\u65e0\u6548\uff0c\u91cd\u65b0init\uff0c\u56e0\u4e3ainit\u65f6\u4f1a\u5e2e\u52a9\u6211\u4eec\u53bb\u68c0\u67e5\u7f51\u7edc\u60c5\u51b5\uff0c\u4e00\u822cinit\u65f6\u6ca1\u6709\u8b66\u544a\u662f\u6ca1\u95ee\u9898\u7684\u3002<br \/>\n\u4f7f\u7528\u547d\u4ee4:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs perl has-numbering\">kubeadm <span class=\"hljs-keyword\">reset<\/span>\nkubeadm init<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u96c6\u7fa4\u521d\u59cb\u5316\u5982\u679c\u9047\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u8fdb\u884c\u6e05\u7406\u518d\u91cd\u65b0\u521d\u59cb\u5316\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs perl has-numbering\">kubeadm <span class=\"hljs-keyword\">reset<\/span>\nifconfig cni<span class=\"hljs-number\">0<\/span> down\nip <span class=\"hljs-keyword\">link<\/span> <span class=\"hljs-keyword\">delete<\/span> cni<span class=\"hljs-number\">0<\/span>\nifconfig flannel.<span class=\"hljs-number\">1<\/span> down\nip <span class=\"hljs-keyword\">link<\/span> <span class=\"hljs-keyword\">delete<\/span> flannel.<span class=\"hljs-number\">1<\/span>\nrm -rf \/var\/lib\/cni\/<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<\/ul>\n<h2 id=\"\u5b89\u88c5pod-network-\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c\"><a name=\"t26\"><\/a>\u5b89\u88c5Pod Network (\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c)<\/h2>\n<p>\u63a5\u4e0b\u6765\u5b89\u88c5flannel network add-on\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">mkdir -p ~\/k8s\/\ncd ~\/k8s\nwget https:\/\/raw<span class=\"hljs-preprocessor\">.githubusercontent<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/coreos\/flannel\/master\/Documentation\/kube-flannel<span class=\"hljs-preprocessor\">.yml<\/span>\nkubectl apply -f  kube-flannel<span class=\"hljs-preprocessor\">.yml<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">clusterrole<span class=\"hljs-built_in\">.<\/span>rbac<span class=\"hljs-built_in\">.<\/span>authorization<span class=\"hljs-built_in\">.<\/span>k8s<span class=\"hljs-built_in\">.<\/span>io\/flannel created\nclusterrolebinding<span class=\"hljs-built_in\">.<\/span>rbac<span class=\"hljs-built_in\">.<\/span>authorization<span class=\"hljs-built_in\">.<\/span>k8s<span class=\"hljs-built_in\">.<\/span>io\/flannel created\nserviceaccount\/flannel created\nconfigmap\/kube<span class=\"hljs-attribute\">-flannel<\/span><span class=\"hljs-attribute\">-cfg<\/span> created\ndaemonset<span class=\"hljs-built_in\">.<\/span>extensions\/kube<span class=\"hljs-attribute\">-flannel<\/span><span class=\"hljs-attribute\">-ds<\/span><span class=\"hljs-attribute\">-amd64<\/span> created\ndaemonset<span class=\"hljs-built_in\">.<\/span>extensions\/kube<span class=\"hljs-attribute\">-flannel<\/span><span class=\"hljs-attribute\">-ds<\/span><span class=\"hljs-attribute\">-arm64<\/span> created\ndaemonset<span class=\"hljs-built_in\">.<\/span>extensions\/kube<span class=\"hljs-attribute\">-flannel<\/span><span class=\"hljs-attribute\">-ds<\/span><span class=\"hljs-attribute\">-arm<\/span> created\ndaemonset<span class=\"hljs-built_in\">.<\/span>extensions\/kube<span class=\"hljs-attribute\">-flannel<\/span><span class=\"hljs-attribute\">-ds<\/span><span class=\"hljs-attribute\">-ppc64le<\/span> created\ndaemonset<span class=\"hljs-built_in\">.<\/span>extensions\/kube<span class=\"hljs-attribute\">-flannel<\/span><span class=\"hljs-attribute\">-ds<\/span><span class=\"hljs-attribute\">-s390x<\/span> created<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<\/ul>\n<p>\u8fd9\u91cc\u53ef\u4ee5cat\u67e5\u770bkube-flannel.yml\u8fd9\u4e2a\u6587\u4ef6\u91cc\u7684flannel\u7684\u955c\u50cf\u7684\u7248\u672c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">cat kube-flannel<span class=\"hljs-preprocessor\">.yml<\/span>|grep quay<span class=\"hljs-preprocessor\">.io<\/span>\/coreos\/flannel<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5982\u679cNode\u6709\u591a\u4e2a\u7f51\u5361\u7684\u8bdd\uff0c\u76ee\u524d\u9700\u8981\u5728kube-flannel.yml\u4e2d\u4f7f\u7528\u2013iface\u53c2\u6570\u6307\u5b9a\u96c6\u7fa4\u4e3b\u673a\u5185\u7f51\u7f51\u5361\u7684\u540d\u79f0\uff0c\u5426\u5219\u53ef\u80fd\u4f1a\u51fa\u73b0dns\u65e0\u6cd5\u89e3\u6790\u3002\u9700\u8981\u5c06kube-flannel.yml\u4e0b\u8f7d\u5230\u672c\u5730\uff0cflanneld\u542f\u52a8\u53c2\u6570\u52a0\u4e0a\u2013iface=<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs haml has-numbering\">containers:\n      -<span class=\"ruby\"> <span class=\"hljs-symbol\">name:<\/span> kube-flannel\n<\/span>        image: quay.io\/coreos\/flannel:v0.10.0-amd64\n        command:\n        -<span class=\"ruby\"> \/opt\/bin\/flanneld\n<\/span>        args:\n        -<span class=\"ruby\"> --ip-masq\n<\/span>        -<span class=\"ruby\"> --kube-subnet-mgr\n<\/span>        -<span class=\"ruby\"> --iface=eth1<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<\/ul>\n<p>\u4f7f\u7528kubectl get pod \u2013all-namespaces -o wide\u786e\u4fdd\u6240\u6709\u7684Pod\u90fd\u5904\u4e8eRunning\u72b6\u6001\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs perl has-numbering\">[root<span class=\"hljs-variable\">@k8s<\/span> k8s]<span class=\"hljs-comment\"># kubectl get pod --all-namespaces -o wide<\/span>\nNAMESPACE     NAME                          READY     STATUS    RESTARTS   AGE       IP              NODE      NOMINATED NODE\nkube-<span class=\"hljs-keyword\">system<\/span>   coredns-<span class=\"hljs-number\">78<\/span>fcdf6894-jf5tn      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">6<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">3<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   coredns-<span class=\"hljs-number\">78<\/span>fcdf6894-ljmmh      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">6<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">2<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   etcd-k8s                      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">5<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-apiserver-k8s            <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">5<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-controller-manager-k8s   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">5<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-flannel-ds-amd64-fvpj7   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">4<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-proxy-c8rrg              <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">6<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-scheduler-k8s            <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">5<\/span><span class=\"hljs-keyword\">m<\/span>        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<\/ul>\n<h2 id=\"master-node\u53c2\u4e0e\u5de5\u4f5c\u8d1f\u8f7d-\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c\"><a name=\"t27\"><\/a>master node\u53c2\u4e0e\u5de5\u4f5c\u8d1f\u8f7d (\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c)<\/h2>\n<p>\u4f7f\u7528kubeadm\u521d\u59cb\u5316\u7684\u96c6\u7fa4\uff0c\u51fa\u4e8e\u5b89\u5168\u8003\u8651Pod\u4e0d\u4f1a\u88ab\u8c03\u5ea6\u5230Master Node\u4e0a\uff0c\u4e5f\u5c31\u662f\u8bf4Master Node\u4e0d\u53c2\u4e0e\u5de5\u4f5c\u8d1f\u8f7d\u3002<\/p>\n<p>\u8fd9\u91cc\u642d\u5efa\u7684\u662f\u6d4b\u8bd5\u73af\u5883\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u4f7fMaster Node\u53c2\u4e0e\u5de5\u4f5c\u8d1f\u8f7d\uff1a<br \/>\nk8s\u662fmaster\u8282\u70b9\u7684hostname<br \/>\n\u5141\u8bb8master\u8282\u70b9\u90e8\u7f72pod\uff0c\u4f7f\u7528\u547d\u4ee4\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">kubectl taint nodes --all node-role<span class=\"hljs-preprocessor\">.kubernetes<\/span><span class=\"hljs-preprocessor\">.io<\/span>\/master-<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\">node <span class=\"hljs-string\">\"k8s\"<\/span> untainted<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u51faerror: taint \u201cnode-role.kubernetes.io\/master:\u201d not found\u9519\u8bef\u5ffd\u7565\u3002<\/p>\n<p>\u7981\u6b62master\u90e8\u7f72pod<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lua has-numbering\">kubectl taint nodes k8s node-role.kubernetes.<span class=\"hljs-built_in\">io<\/span>\/master=<span class=\"hljs-keyword\">true<\/span>:NoSchedule<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<h2 id=\"\u6d4b\u8bd5dns-\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c\"><a name=\"t28\"><\/a>\u6d4b\u8bd5DNS (\u53ea\u5728\u4e3b\u8282\u70b9\u6267\u884c)<\/h2>\n<p>\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs brainfuck has-numbering\"><span class=\"hljs-comment\">kubectl<\/span> <span class=\"hljs-comment\">run<\/span> <span class=\"hljs-comment\">curl<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">image=radial\/busyboxplus:curl<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">i<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">tty<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f93\u51fa\u5982\u4e0b\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vbnet has-numbering\"><span class=\"hljs-keyword\">If<\/span> you don<span class=\"hljs-comment\">'t see a command prompt, try pressing enter.<\/span>\n[ root@curl-<span class=\"hljs-number\">87<\/span>b54756-vsf2s:\/ ]$ <\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u8fdb\u5165\u540e\u6267\u884c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs cs has-numbering\">nslookup kubernetes.<span class=\"hljs-keyword\">default<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u786e\u8ba4\u89e3\u6790\u6b63\u5e38,\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">[ root@curl-<span class=\"hljs-number\">87<\/span>b54756-vsf2s:\/ ]$ nslookup kubernetes<span class=\"hljs-preprocessor\">.default<\/span>\n<span class=\"hljs-label\">Server:<\/span>    <span class=\"hljs-number\">10.96<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.10<\/span>\nAddress <span class=\"hljs-number\">1<\/span>: <span class=\"hljs-number\">10.96<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.10<\/span> kube-dns<span class=\"hljs-preprocessor\">.kube<\/span>-system<span class=\"hljs-preprocessor\">.svc<\/span><span class=\"hljs-preprocessor\">.cluster<\/span><span class=\"hljs-preprocessor\">.local<\/span>\n\n<span class=\"hljs-label\">Name:<\/span>      kubernetes<span class=\"hljs-preprocessor\">.default<\/span>\nAddress <span class=\"hljs-number\">1<\/span>: <span class=\"hljs-number\">10.96<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.1<\/span> kubernetes<span class=\"hljs-preprocessor\">.default<\/span><span class=\"hljs-preprocessor\">.svc<\/span><span class=\"hljs-preprocessor\">.cluster<\/span><span class=\"hljs-preprocessor\">.local<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<\/ul>\n<p>\u8f93\u5165<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-keyword\">exit<\/span>;<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u53ef\u9000\u51faimage\u3002<\/p>\n<p><img decoding=\"async\" title=\"\" src=\"http:\/\/image.525.life\/FmwTA5Xks4XYAjLyWUj1BHNXpIOw\" alt=\"\" \/><\/p>\n<h2 id=\"\u5411kubernetes\u96c6\u7fa4\u6dfb\u52a0node-\u53ea\u5728\u526f\u8282\u70b9\u6267\u884c\"><a name=\"t29\"><\/a>\u5411Kubernetes\u96c6\u7fa4\u6dfb\u52a0Node (\u53ea\u5728\u526f\u8282\u70b9\u6267\u884c)<\/h2>\n<p>\u4e0b\u9762\u6211\u4eec\u5c06k8s1\u8fd9\u4e2a\u4e3b\u673a\u6dfb\u52a0\u5230Kubernetes\u96c6\u7fa4\u4e2d\uff0c\u5728k8s1\u4e0a\u6267\u884c\u4e4b\u524d\u7684\u52a0\u5165\u8bed\u53e5:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">kubeadm <span class=\"hljs-keyword\">join<\/span> <span class=\"hljs-number\">192.168<\/span><span class=\"hljs-number\">.11<\/span><span class=\"hljs-number\">.90<\/span>:<span class=\"hljs-number\">6443<\/span> <span class=\"hljs-subst\">--<\/span>token hu2clf<span class=\"hljs-number\">.898<\/span>he8fnu64w3fur <span class=\"hljs-subst\">--<\/span>discovery<span class=\"hljs-attribute\">-token<\/span><span class=\"hljs-attribute\">-ca<\/span><span class=\"hljs-attribute\">-cert<\/span><span class=\"hljs-attribute\">-hash<\/span> sha256:<span class=\"hljs-number\">2<\/span>a196bbd77e4152a700d294a666e9d97336d0f7097f55e19a651c19e03d340a4<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6b63\u786e\u52a0\u5165\u8f93\u51fa\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs applescript has-numbering\">[root@k8s1 ~]<span class=\"hljs-comment\"># kubeadm join 192.168.11.90:6443 --token hu2clf.898he8fnu64w3fur --discovery-token-ca-cert-hash sha256:2a196bbd77e4152a700d294a666e9d97336d0f7097f55e19a651c19e03d340a4<\/span>\n[preflight] <span class=\"hljs-property\">running<\/span> pre-flight checks\n    [WARNING RequiredIPVSKernelModulesAvailable]: <span class=\"hljs-keyword\">the<\/span> IPVS proxier will <span class=\"hljs-keyword\">not<\/span> be used, because <span class=\"hljs-keyword\">the<\/span> following required kernel modules are <span class=\"hljs-keyword\">not<\/span> loaded: [ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh] <span class=\"hljs-keyword\">or<\/span> no builtin kernel ipvs support: map[ip_vs:{} ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{}]\nyou can solve this problem <span class=\"hljs-keyword\">with<\/span> following methods:\n <span class=\"hljs-number\">1.<\/span> Run 'modprobe <span class=\"hljs-comment\">-- ' to load missing kernel modules;<\/span>\n<span class=\"hljs-number\">2.<\/span> Provide <span class=\"hljs-keyword\">the<\/span> missing builtin kernel ipvs support\n\nI0815 <span class=\"hljs-number\">16<\/span>:<span class=\"hljs-number\">53<\/span>:<span class=\"hljs-number\">55.675009<\/span>    <span class=\"hljs-number\">2758<\/span> kernel_validator.go:<span class=\"hljs-number\">81<\/span>] Validating kernel <span class=\"hljs-property\">version<\/span>\nI0815 <span class=\"hljs-number\">16<\/span>:<span class=\"hljs-number\">53<\/span>:<span class=\"hljs-number\">55.675090<\/span>    <span class=\"hljs-number\">2758<\/span> kernel_validator.go:<span class=\"hljs-number\">96<\/span>] Validating kernel config\n[discovery] Trying <span class=\"hljs-keyword\">to<\/span> connect <span class=\"hljs-keyword\">to<\/span> API Server <span class=\"hljs-string\">\"192.168.11.90:6443\"<\/span>\n[discovery] Created cluster-info discovery client, requesting info <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"https:\/\/192.168.11.90:6443\"<\/span>\n[discovery] Requesting info <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"https:\/\/192.168.11.90:6443\"<\/span> again <span class=\"hljs-keyword\">to<\/span> validate TLS <span class=\"hljs-keyword\">against<\/span> <span class=\"hljs-keyword\">the<\/span> pinned public key\n[discovery] Cluster info signature <span class=\"hljs-keyword\">and<\/span> <span class=\"hljs-property\">contents<\/span> are valid <span class=\"hljs-keyword\">and<\/span> TLS certificate validates <span class=\"hljs-keyword\">against<\/span> pinned roots, will use API Server <span class=\"hljs-string\">\"192.168.11.90:6443\"<\/span>\n[discovery] Successfully established connection <span class=\"hljs-keyword\">with<\/span> API Server <span class=\"hljs-string\">\"192.168.11.90:6443\"<\/span>\n[kubelet] Downloading configuration <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-keyword\">the<\/span> kubelet <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-keyword\">the<\/span> <span class=\"hljs-string\">\"kubelet-config-1.11\"<\/span> ConfigMap <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">the<\/span> kube-system namespace\n[kubelet] Writing kubelet configuration <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-type\">file<\/span> <span class=\"hljs-string\">\"\/var\/lib\/kubelet\/config.yaml\"<\/span>\n[kubelet] Writing kubelet environment <span class=\"hljs-type\">file<\/span> <span class=\"hljs-keyword\">with<\/span> flags <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-type\">file<\/span> <span class=\"hljs-string\">\"\/var\/lib\/kubelet\/kubeadm-flags.env\"<\/span>\n[preflight] Activating <span class=\"hljs-keyword\">the<\/span> kubelet service\n[tlsbootstrap] Waiting <span class=\"hljs-keyword\">for<\/span> <span class=\"hljs-keyword\">the<\/span> kubelet <span class=\"hljs-keyword\">to<\/span> perform <span class=\"hljs-keyword\">the<\/span> TLS Bootstrap...\n[patchnode] Uploading <span class=\"hljs-keyword\">the<\/span> CRI Socket information <span class=\"hljs-string\">\"\/var\/run\/dockershim.sock\"<\/span> <span class=\"hljs-keyword\">to<\/span> <span class=\"hljs-keyword\">the<\/span> Node API object <span class=\"hljs-string\">\"k8s1\"<\/span> <span class=\"hljs-keyword\">as<\/span> an annotation\n\nThis node has joined <span class=\"hljs-keyword\">the<\/span> cluster:\n* Certificate signing request was sent <span class=\"hljs-keyword\">to<\/span> master <span class=\"hljs-keyword\">and<\/span> a response\n  was received.\n* The Kubelet was informed <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-keyword\">the<\/span> new secure connection details.\n\nRun 'kubectl <span class=\"hljs-keyword\">get<\/span> nodes' <span class=\"hljs-function_start\"><span class=\"hljs-keyword\">on<\/span><\/span> <span class=\"hljs-keyword\">the<\/span> master <span class=\"hljs-keyword\">to<\/span> see this node join <span class=\"hljs-keyword\">the<\/span> cluster.<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<li>26<\/li>\n<li>27<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u5728master\u8282\u70b9\u4e0a\u6267\u884c\u547d\u4ee4\u67e5\u770b\u96c6\u7fa4\u4e2d\u7684\u8282\u70b9\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ruby has-numbering\">[root<span class=\"hljs-variable\">@k8s<\/span> k8s]<span class=\"hljs-comment\"># kubectl get nodes<\/span>\n<span class=\"hljs-constant\">NAME<\/span>      <span class=\"hljs-constant\">STATUS<\/span>     <span class=\"hljs-constant\">ROLES<\/span>     <span class=\"hljs-constant\">AGE<\/span>       <span class=\"hljs-constant\">VERSION<\/span>\nk8s       <span class=\"hljs-constant\">Ready<\/span>      master    <span class=\"hljs-number\">30<\/span>m       v1.<span class=\"hljs-number\">11.2<\/span>\nk8s1      <span class=\"hljs-constant\">NotReady<\/span>   &lt;none&gt;    <span class=\"hljs-number\">1<\/span>m        v1.<span class=\"hljs-number\">11.2<\/span>\nk8s2      <span class=\"hljs-constant\">NotReady<\/span>   &lt;none&gt;    <span class=\"hljs-number\">1<\/span>m        v1.<span class=\"hljs-number\">11.2<\/span>\n[root<span class=\"hljs-variable\">@k8s<\/span> k8s]<span class=\"hljs-comment\"># <\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<\/ul>\n<p>\u5982\u679c\u526f\u8282\u70b9\u662fNotReady\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u68c0\u67e5\u662f\u5426\u6709\u62a5\u9519<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">systemctl status kubelet<span class=\"hljs-preprocessor\">.service<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u4f7f\u7528\u547d\u4ee4\u68c0\u67e5pod\u662f\u5426\u662frunning\u72b6\u6001<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs perl has-numbering\">[root<span class=\"hljs-variable\">@k8s<\/span> kubernetes]<span class=\"hljs-comment\"># kubectl get pod --all-namespaces -o wide<\/span>\nNAMESPACE     NAME                          READY     STATUS              RESTARTS   AGE       IP              NODE      NOMINATED NODE\ndefault       curl-<span class=\"hljs-number\">87<\/span>b54756-vsf2s           <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">1<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">4<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   coredns-<span class=\"hljs-number\">78<\/span>fcdf6894-jf5tn      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">3<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   coredns-<span class=\"hljs-number\">78<\/span>fcdf6894-ljmmh      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">2<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   etcd-k8s                      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-apiserver-k8s            <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-controller-manager-k8s   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-flannel-ds-amd64-<span class=\"hljs-number\">8<\/span>p2px   <span class=\"hljs-number\">0<\/span>\/<span class=\"hljs-number\">1<\/span>       Init:<span class=\"hljs-number\">0<\/span>\/<span class=\"hljs-number\">1<\/span>            <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.91<\/span>   k8s1      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-flannel-ds-amd64-fvpj7   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-flannel-ds-amd64-p6g4w   <span class=\"hljs-number\">0<\/span>\/<span class=\"hljs-number\">1<\/span>       Init:<span class=\"hljs-number\">0<\/span>\/<span class=\"hljs-number\">1<\/span>            <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.92<\/span>   k8s2      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-proxy-c8rrg              <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-proxy-hp4lj              <span class=\"hljs-number\">0<\/span>\/<span class=\"hljs-number\">1<\/span>       ContainerCreating   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.92<\/span>   k8s2      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-proxy-tn2fl              <span class=\"hljs-number\">0<\/span>\/<span class=\"hljs-number\">1<\/span>       ContainerCreating   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.91<\/span>   k8s1      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-scheduler-k8s            <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running             <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<\/ul>\n<p>\u5982\u679c\u5361\u5728ContainerCreating\u72b6\u6001\u548cInit:0\/1\u4e00\u822c\u4e5f\u662f\u526f\u8282\u70b9\u7684\u955c\u50cf\u83b7\u53d6\u4e0d\u5230\u7684\u95ee\u9898\uff0c\u8bf7\u56de\u5230 \u51c6\u5907\u955c\u50cf\u5c0f\u8282\u3002<br \/>\n\u51c6\u5907\u597d\u955c\u50cf\u4e4b\u540e\u4e00\u822c\u5f88\u5feb\u5c31\u4f1a\u53d8\u6210running\u72b6\u6001\u5982\u4e0b:<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs perl has-numbering\">[root<span class=\"hljs-variable\">@k8s<\/span> kubernetes]<span class=\"hljs-comment\"># kubectl get pod --all-namespaces -o wide<\/span>\nNAMESPACE     NAME                          READY     STATUS    RESTARTS   AGE       IP              NODE      NOMINATED NODE\ndefault       curl-<span class=\"hljs-number\">87<\/span>b54756-vsf2s           <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">1<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">4<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   coredns-<span class=\"hljs-number\">78<\/span>fcdf6894-jf5tn      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">3<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   coredns-<span class=\"hljs-number\">78<\/span>fcdf6894-ljmmh      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">10.244<\/span>.<span class=\"hljs-number\">0<\/span>.<span class=\"hljs-number\">2<\/span>      k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   etcd-k8s                      <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-apiserver-k8s            <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-controller-manager-k8s   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-flannel-ds-amd64-<span class=\"hljs-number\">8<\/span>p2px   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.91<\/span>   k8s1      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-flannel-ds-amd64-fvpj7   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-flannel-ds-amd64-p6g4w   <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.92<\/span>   k8s2      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-proxy-c8rrg              <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-proxy-hp4lj              <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.92<\/span>   k8s2      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-proxy-tn2fl              <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">1<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.91<\/span>   k8s1      &lt;none&gt;\nkube-<span class=\"hljs-keyword\">system<\/span>   kube-scheduler-k8s            <span class=\"hljs-number\">1<\/span>\/<span class=\"hljs-number\">1<\/span>       Running   <span class=\"hljs-number\">0<\/span>          <span class=\"hljs-number\">2<\/span>h        <span class=\"hljs-number\">192.168<\/span>.<span class=\"hljs-number\">11.90<\/span>   k8s       &lt;none&gt;<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<\/ul>\n<p>\u6b64\u65f6\u67e5\u770bnodes\u4e5f\u5df2\u7ecf\u53d8\u6210\u4e86ready\u72b6\u6001<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ruby has-numbering\">[root<span class=\"hljs-variable\">@k8s<\/span> kubernetes]<span class=\"hljs-comment\"># kubectl get nodes<\/span>\n<span class=\"hljs-constant\">NAME<\/span>      <span class=\"hljs-constant\">STATUS<\/span>    <span class=\"hljs-constant\">ROLES<\/span>     <span class=\"hljs-constant\">AGE<\/span>       <span class=\"hljs-constant\">VERSION<\/span>\nk8s       <span class=\"hljs-constant\">Ready<\/span>     master    <span class=\"hljs-number\">2<\/span>h        v1.<span class=\"hljs-number\">11.2<\/span>\nk8s1      <span class=\"hljs-constant\">Ready<\/span>     &lt;none&gt;    <span class=\"hljs-number\">1<\/span>h        v1.<span class=\"hljs-number\">11.2<\/span>\nk8s2      <span class=\"hljs-constant\">Ready<\/span>     &lt;none&gt;    <span class=\"hljs-number\">1<\/span>h        v1.<span class=\"hljs-number\">11.2<\/span>\n[root<span class=\"hljs-variable\">@k8s<\/span> kubernetes]<span class=\"hljs-comment\"># <\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<\/ul>\n<p>\u5982\u679c\u526f\u8282\u70b9\u4e5f\u9700\u8981\u4f7f\u7528kubectl\u547d\u4ee4\u5219\u9700\u8981\u628aconf\u6587\u4ef6\u590d\u5236\u8fc7\u53bb\uff0c\u4f7f\u7528\u547d\u4ee4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">mkdir <span class=\"hljs-attribute\">-p<\/span> <span class=\"hljs-variable\">$HOME<\/span><span class=\"hljs-subst\">\/<\/span><span class=\"hljs-built_in\">.<\/span>kube\nsudo cp <span class=\"hljs-attribute\">-i<\/span>  admin<span class=\"hljs-built_in\">.<\/span>conf <span class=\"hljs-variable\">$HOME<\/span><span class=\"hljs-subst\">\/<\/span><span class=\"hljs-built_in\">.<\/span>kube\/config\nsudo chown $(id <span class=\"hljs-attribute\">-u<\/span>):$(id <span class=\"hljs-attribute\">-g<\/span>) <span class=\"hljs-variable\">$HOME<\/span><span class=\"hljs-subst\">\/<\/span><span class=\"hljs-built_in\">.<\/span>kube\/config<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<h2 id=\"\u5982\u4f55\u4ece\u96c6\u7fa4\u4e2d\u79fb\u9664node\"><a name=\"t30\"><\/a>\u5982\u4f55\u4ece\u96c6\u7fa4\u4e2d\u79fb\u9664Node<\/h2>\n<p>\u5982\u679c\u9700\u8981\u4ece\u96c6\u7fa4\u4e2d\u79fb\u9664k8s2\u8fd9\u4e2aNode\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<p>\u5728master\u8282\u70b9\u4e0a\u6267\u884c\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs brainfuck has-numbering\"><span class=\"hljs-comment\">kubectl<\/span> <span class=\"hljs-comment\">drain<\/span> <span class=\"hljs-comment\">k8s2<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">delete<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">local<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">data<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">force<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">ignore<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">daemonsets<\/span>\n<span class=\"hljs-comment\">kubectl<\/span> <span class=\"hljs-comment\">delete<\/span> <span class=\"hljs-comment\">node<\/span> <span class=\"hljs-comment\">k8s2<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u5728k8s2\u4e0a\u6267\u884c\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs perl has-numbering\">kubeadm <span class=\"hljs-keyword\">reset<\/span>\nifconfig cni<span class=\"hljs-number\">0<\/span> down\nip <span class=\"hljs-keyword\">link<\/span> <span class=\"hljs-keyword\">delete<\/span> cni<span class=\"hljs-number\">0<\/span>\nifconfig flannel.<span class=\"hljs-number\">1<\/span> down\nip <span class=\"hljs-keyword\">link<\/span> <span class=\"hljs-keyword\">delete<\/span> flannel.<span class=\"hljs-number\">1<\/span>\nrm -rf \/var\/lib\/cni\/<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<\/ul>\n<p>\u5230\u8fd9\u91cc\u6211\u4eec\u5c31\u7b97\u6210\u529f\u5b89\u88c5\u597d\u4e86k8s\u96c6\u7fa4\u4e86\u3002<\/p>\n<p>\u4e00\u822c\u6765\u8bf4 \u6211\u4eec \u8fd8\u9700\u8981\u5b89\u88c5dashboard\u76d1\u63a7\u754c\u9762\u3002<\/p>\n<p>\u53ef\u53c2\u8003\u6587\u7ae0:<br \/>\n<a title=\"k8s---dashboardv1.8.3\u7248\u672c\u5b89\u88c5\u8be6\u7ec6\u6b65\u9aa4\" href=\"http:\/\/www.525.life\/article?id=1510739742372\" target=\"_blank\" rel=\"nofollow noopener\">k8s\u2014dashboardv1.8.3\u7248\u672c\u5b89\u88c5\u8be6\u7ec6\u6b65\u9aa4<\/a><\/p>\n<h1 id=\"centos\u7cfb\u7edf\u4e2d\u76f4\u63a5\u4f7f\u7528yum\u5b89\u88c5\"><a name=\"t31\"><\/a>CentOS\u7cfb\u7edf\u4e2d\u76f4\u63a5\u4f7f\u7528yum\u5b89\u88c5<\/h1>\n<p>\u7ed9yum\u6e90\u589e\u52a0\u4e00\u4e2aRepo<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ini has-numbering\"><span class=\"hljs-title\">[virt7-docker-common-release]<\/span>\n<span class=\"hljs-setting\">name=<span class=\"hljs-value\">virt7-docker-common-release<\/span><\/span>\n<span class=\"hljs-setting\">baseurl=<span class=\"hljs-value\">http:\/\/cbs.centos.org\/repos\/virt7-docker-common-release\/x86_64\/os\/<\/span><\/span>\n<span class=\"hljs-setting\">gpgcheck=<span class=\"hljs-value\"><span class=\"hljs-number\">0<\/span><\/span><\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<p>\u5b89\u88c5docker\u3001kubernetes\u3001etcd\u3001flannel\u4e00\u6b65\u5230\u4f4d<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">yum <span class=\"hljs-attribute\">-y<\/span> install <span class=\"hljs-subst\">--<\/span>enablerepo<span class=\"hljs-subst\">=<\/span>virt7<span class=\"hljs-attribute\">-docker<\/span><span class=\"hljs-attribute\">-common<\/span><span class=\"hljs-attribute\">-release<\/span> kubernetes etcd flannel<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5b89\u88c5\u597d\u4e86\u4e4b\u540e\u9700\u8981\u4fee\u6539\u4e00\u7cfb\u5217\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p>\u8fd9\u4e2arepo\u5728CentOS7.3\u4e0b\u662f\u6beb\u65e0\u610f\u4e49\u7684\uff0c\u56e0\u4e3aCentOS\u5b98\u65b9\u6e90\u7684extras\u4e2d\u5df2\u7ecf\u5305\u542b\u4e86Kubernetes1.5.2\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fCentOS7.3\u7684\u8bdd\uff0c\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u5b89\u88c5Kubernetes1.5.2\uff08Till March 30,2017\uff09\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fCentOS7.2\u7684\u5316\uff0c\u8fd9\u4e2a\u6e90\u5c31\u6709\u7528\u4e86\uff0c\u4f46\u662f\u4e0d\u5e78\u7684\u662f\uff0c\u5b83\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u5b89\u88c5Kubernentes1.1\u3002\u6211\u4eec\u73b0\u5728\u8981\u5b89\u88c5\u76ee\u524d\u7684\u6700\u65b0\u7248\u672cKubernetes1.6\uff0c\u800c\u4f7f\u7528\u7684\u53c8\u662fCentOS7.2\uff0c\u6240\u4ee5\u6211\u4eec\u4e0d\u4f7f\u7528yum\u5b89\u88c5\uff08\u5f53\u524dyum\u6e90\u652f\u6301\u7684\u6700\u9ad8\u7248\u672c\u7684kuberentes\u662f1.5.2\uff09\u3002<\/p>\n<h1 id=\"\u4f7f\u7528\u4e8c\u8fdb\u5236\u6587\u4ef6\u5b89\u88c5\"><a name=\"t32\"><\/a>\u4f7f\u7528\u4e8c\u8fdb\u5236\u6587\u4ef6\u5b89\u88c5<\/h1>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u5b89\u88c5\u7684\u8bdd\uff0c\u9700\u8981\u81ea\u5df1\u4e00\u4e2a\u4e00\u4e2a\u7ec4\u4ef6\u7684\u5b89\u88c5\u3002<\/p>\n<p>\u9996\u5148\u9700\u8981\u5206\u914d\u597d\u54ea\u4e9b\u8282\u70b9\u5b89\u88c5\u4ec0\u4e48\u7ec4\u4ef6\u548c\u670d\u52a1\u3002<\/p>\n<p>master\/node\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u670d\u52a1:<br \/>\nkube-apiserver kube-controller-manager kube-scheduler kubelet kube-proxy etcd flannel kubectl docker<br \/>\nnode\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u670d\u52a1<br \/>\nnode kubectl kube-proxy flannel docker<\/p>\n<h2 id=\"\u5b89\u88c5docker-1\"><a name=\"t33\"><\/a>\u5b89\u88c5Docker<\/h2>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">yum localistall <span class=\"hljs-built_in\">.<\/span>\/docker<span class=\"hljs-attribute\">-engine<\/span><span class=\"hljs-subst\">*<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u5c06\u4f7f\u7528CentOS\u7684extras repo\u4e0b\u8f7ddocker\u3002<\/p>\n<h2 id=\"\u5173\u95ed\u9632\u706b\u5899\u548cselinux\"><a name=\"t34\"><\/a>\u5173\u95ed\u9632\u706b\u5899\u548cSELinux<\/h2>\n<p>\u8fd9\u662f\u5b98\u7f51\u4e0a\u5efa\u8bae\u7684\uff0c\u6211\u662f\u76f4\u63a5\u5c06iptables-services\u548cfirewlld\u5378\u8f7d\u6389\u4e86\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">setenforce <span class=\"hljs-number\">0<\/span>\nsystemctl disable iptables<span class=\"hljs-attribute\">-services<\/span> firewalld\nsystemctl stop iptables<span class=\"hljs-attribute\">-services<\/span> firewalld<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<\/ul>\n<h2 id=\"\u5b89\u88c5etcd\"><a name=\"t35\"><\/a>\u5b89\u88c5etcd<\/h2>\n<p>\u4e0b\u8f7d\u4e8c\u8fdb\u5236\u6587\u4ef6<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">DOWNLOAD_URL=https:\/\/storage<span class=\"hljs-preprocessor\">.googleapis<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/etcd  <span class=\"hljs-preprocessor\">#etcd\u5b58\u50a8\u5730\u5740<\/span>\nETCD_VER=v3<span class=\"hljs-number\">.1<\/span><span class=\"hljs-number\">.5<\/span>  <span class=\"hljs-preprocessor\">#\u8bbe\u7f6eetcd\u7248\u672c\u53f7<\/span>\nwget ${DOWNLOAD_URL}\/${ETCD_VER}\/etcd-${ETCD_VER}-linux-amd64<span class=\"hljs-preprocessor\">.tar<\/span><span class=\"hljs-preprocessor\">.gz<\/span>\ntar xvf etcd-${ETCD_VER}-linux-amd64<span class=\"hljs-preprocessor\">.tar<\/span><span class=\"hljs-preprocessor\">.gz<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<h2 id=\"\u90e8\u7f72\u6587\u4ef6\"><a name=\"t36\"><\/a>\u90e8\u7f72\u6587\u4ef6<\/h2>\n<p>\u5c06\u5982\u4e0b\u5185\u5bb9\u5199\u5165\u6587\u4ef6 \/etc\/etcd\/etcd.conf \u4e2d\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\"># [member]<\/span>\nETCD_NAME=<span class=\"hljs-keyword\">default<\/span>\nETCD_DATA_DIR=<span class=\"hljs-string\">\"\/var\/lib\/etcd\/default.etcd\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_WAL_DIR=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_SNAPSHOT_COUNT=\"10000\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_HEARTBEAT_INTERVAL=\"100\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_ELECTION_TIMEOUT=\"1000\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_LISTEN_PEER_URLS=\"http:\/\/localhost:2380\"<\/span>\nETCD_LISTEN_CLIENT_URLS=<span class=\"hljs-string\">\"http:\/\/0.0.0.0:2379\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_MAX_SNAPSHOTS=\"5\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_MAX_WALS=\"5\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_CORS=\"\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\"># [cluster]<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_INITIAL_ADVERTISE_PEER_URLS=\"http:\/\/localhost:2380\"<\/span>\n<span class=\"hljs-preprocessor\"># if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. \"test=http:\/\/...\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_INITIAL_CLUSTER=\"default=http:\/\/localhost:2380\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_INITIAL_CLUSTER_STATE=\"new\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_INITIAL_CLUSTER_TOKEN=\"etcd-cluster\"<\/span>\nETCD_ADVERTISE_CLIENT_URLS=<span class=\"hljs-string\">\"http:\/\/0.0.0.0:2379\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_DISCOVERY=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_DISCOVERY_SRV=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_DISCOVERY_FALLBACK=\"proxy\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_DISCOVERY_PROXY=\"\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\"># [proxy]<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PROXY=\"off\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PROXY_FAILURE_WAIT=\"5000\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PROXY_REFRESH_INTERVAL=\"30000\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PROXY_DIAL_TIMEOUT=\"1000\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PROXY_WRITE_TIMEOUT=\"5000\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PROXY_READ_TIMEOUT=\"0\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\"># [security]<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_CERT_FILE=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_KEY_FILE=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_CLIENT_CERT_AUTH=\"false\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_TRUSTED_CA_FILE=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PEER_CERT_FILE=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PEER_KEY_FILE=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PEER_CLIENT_CERT_AUTH=\"false\"<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_PEER_TRUSTED_CA_FILE=\"\"<\/span>\n<span class=\"hljs-preprocessor\"># [logging]<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_DEBUG=\"false\"<\/span>\n<span class=\"hljs-preprocessor\"># examples for -log-package-levels etcdserver=WARNING,security=DEBUG<\/span>\n<span class=\"hljs-preprocessor\"># ETCD_LOG_PACKAGE_LEVELS=\"\"<\/span>\n\u5c06 etcd, etcdctl\u653e\u5165 \/usr\/bin\/\u4e0b\uff0c\u5e76\u5c06\u5982\u4e0b\u5185\u5bb9\u5199\u8fdb\/usr\/lib\/systemd\/system\/etcd.service\u6587\u4ef6\n\n[Unit]\nDescription=Etcd Server\nAfter=network.target\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=notify\nWorkingDirectory=\/<span class=\"hljs-keyword\">var<\/span>\/lib\/etcd\/\nEnvironmentFile=-\/etc\/etcd\/etcd.conf\nUser=etcd\n<span class=\"hljs-preprocessor\"># set GOMAXPROCS to number of processors<\/span>\nExecStart=\/bin\/bash -c <span class=\"hljs-string\">\"GOMAXPROCS=$(nproc) \/usr\/bin\/etcd --name=\\\"${ETCD_NAME}\\\" --data-dir=\\\"${ETCD_DATA_DIR}\\\" --listen-client-urls=\\\"${ETCD_LISTEN_CLIENT_URLS}\\\"\"<\/span>\nRestart=on-failure\nLimitNOFILE=<span class=\"hljs-number\">65536<\/span>\n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<li>26<\/li>\n<li>27<\/li>\n<li>28<\/li>\n<li>29<\/li>\n<li>30<\/li>\n<li>31<\/li>\n<li>32<\/li>\n<li>33<\/li>\n<li>34<\/li>\n<li>35<\/li>\n<li>36<\/li>\n<li>37<\/li>\n<li>38<\/li>\n<li>39<\/li>\n<li>40<\/li>\n<li>41<\/li>\n<li>42<\/li>\n<li>43<\/li>\n<li>44<\/li>\n<li>45<\/li>\n<li>46<\/li>\n<li>47<\/li>\n<li>48<\/li>\n<li>49<\/li>\n<li>50<\/li>\n<li>51<\/li>\n<li>52<\/li>\n<li>53<\/li>\n<li>54<\/li>\n<li>55<\/li>\n<li>56<\/li>\n<li>57<\/li>\n<li>58<\/li>\n<li>59<\/li>\n<li>60<\/li>\n<li>61<\/li>\n<li>62<\/li>\n<li>63<\/li>\n<li>64<\/li>\n<li>65<\/li>\n<li>66<\/li>\n<\/ul>\n<h2 id=\"\u542f\u52a8\u5e76\u6821\u9a8c\"><a name=\"t37\"><\/a>\u542f\u52a8\u5e76\u6821\u9a8c<\/h2>\n<pre class=\"prettyprint\"><code class=\"hljs sql has-numbering\">systemctl <span class=\"hljs-operator\"><span class=\"hljs-keyword\">start<\/span> etcd\nsystemctl enable etcd\nsystemctl status etcd\netcdctl ls<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<\/ul>\n<h2 id=\"\u96c6\u7fa4\"><a name=\"t38\"><\/a>\u96c6\u7fa4<\/h2>\n<p>\u82e5\u8981\u90e8\u7f72\u591a\u8282\u70b9\u96c6\u7fa4\u4e5f\u6bd4\u8f83\u7b80\u5355\uff0c\u53ea\u8981\u66f4\u6539etcd.conf\u6587\u4ef6\u4ee5\u53caetcd.service\u6dfb\u52a0\u76f8\u5e94\u914d\u7f6e\u5373\u53ef<\/p>\n<p>\u53c2\u8003 <a title=\"etcd Clustering Guide\" href=\"https:\/\/github.com\/coreos\/etcd\/blob\/master\/Documentation\/op-guide\/clustering.md\" target=\"_blank\" rel=\"nofollow noopener\">etcd Clustering Guide<\/a><\/p>\n<h2 id=\"\u5b89\u88c5flannel\"><a name=\"t39\"><\/a>\u5b89\u88c5flannel<\/h2>\n<p>\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528yum install flannel\u5b89\u88c5\u3002<\/p>\n<p>\u56e0\u4e3a\u7f51\u7edc\u8fd9\u5757\u7684\u914d\u7f6e\u6bd4\u8f83\u590d\u6742\uff0c\u6211\u5c06\u5728\u540e\u7eed\u6587\u7ae0\u4e2d\u8bf4\u660e\u3002<\/p>\n<h2 id=\"\u5b89\u88c5kubernetes\"><a name=\"t40\"><\/a>\u5b89\u88c5Kubernetes<\/h2>\n<p>\u6839\u636e\u300aKubernetes\u6743\u5a01\u6307\u5357\uff08\u7b2c\u4e8c\u7248\uff09\u300b\u4e2d\u7684\u4ecb\u7ecd\uff0c\u76f4\u63a5\u4f7f\u7528GitHub\u4e0a\u7684release\u91cc\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u5b89\u88c5\u3002<\/p>\n<p>\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u5b89\u88c5\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">wget https:\/\/github<span class=\"hljs-preprocessor\">.com<\/span>\/kubernetes\/kubernetes\/releases\/download\/v1<span class=\"hljs-number\">.6<\/span><span class=\"hljs-number\">.0<\/span>\/kubernetes<span class=\"hljs-preprocessor\">.tar<\/span><span class=\"hljs-preprocessor\">.gz<\/span>\ntar kubernetes<span class=\"hljs-preprocessor\">.tar<\/span><span class=\"hljs-preprocessor\">.gz<\/span>\ncd kubernetes\n.\/cluster\/get-kube-binaries<span class=\"hljs-preprocessor\">.sh<\/span>\ncd server\ntar xvf kubernetes-server-linux-amd64<span class=\"hljs-preprocessor\">.tar<\/span><span class=\"hljs-preprocessor\">.gz<\/span>\nrm -f *_tag *<span class=\"hljs-preprocessor\">.tar<\/span>\nchmod <span class=\"hljs-number\">755<\/span> *\nmv * \/usr\/bin<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<\/ul>\n<p>\u4ece\u4e0b\u9762\u7684\u5730\u5740\u4e0b\u8f7dkubernetes-server-linux-amd64.tar.gz<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\"><span class=\"hljs-label\">https:<\/span>\/\/storage<span class=\"hljs-preprocessor\">.googleapis<\/span><span class=\"hljs-preprocessor\">.com<\/span>\/kubernetes-release\/release\/v1<span class=\"hljs-number\">.6<\/span><span class=\"hljs-number\">.0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u89e3\u538b\u5b8c\u540e\u83b7\u5f97\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u6709\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">cloud<span class=\"hljs-attribute\">-controller<\/span><span class=\"hljs-attribute\">-manager<\/span>\nhyperkube\nkubeadm\nkube<span class=\"hljs-attribute\">-aggregator<\/span>\nkube<span class=\"hljs-attribute\">-apiserver<\/span>\nkube<span class=\"hljs-attribute\">-controller<\/span><span class=\"hljs-attribute\">-manager<\/span>\nkubectl\nkubefed\nkubelet\nkube<span class=\"hljs-attribute\">-proxy<\/span>\nkube<span class=\"hljs-attribute\">-scheduler<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<\/ul>\n<p>\u5728cluster\/juju\/layers\/kubernetes-master\/templates\u76ee\u5f55\u4e0b\u6709service\u548c\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u6587\u4ef6\u7684\u6a21\u677f\uff0c\u8fd9\u4e2a\u6a21\u677f\u672c\u6765\u662f\u4e3a\u4e86\u4f7f\u7528juju\u5b89\u88c5\u5199\u7684\u3002<\/p>\n<h2 id=\"master\u8282\u70b9\u7684\u914d\u7f6e\"><a name=\"t41\"><\/a>Master\u8282\u70b9\u7684\u914d\u7f6e<\/h2>\n<p>Master\u8282\u70b9\u9700\u8981\u914d\u7f6e\u7684kubernetes\u7684\u7ec4\u4ef6\u6709\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">kube<span class=\"hljs-attribute\">-apiserver<\/span>\nkube<span class=\"hljs-attribute\">-controller<\/span><span class=\"hljs-attribute\">-manager<\/span>\nkube<span class=\"hljs-attribute\">-scheduler<\/span>\nkube<span class=\"hljs-attribute\">-proxy<\/span>\nkubectl<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<\/ul>\n<h2 id=\"\u914d\u7f6ekube-apiserver\"><a name=\"t42\"><\/a>\u914d\u7f6ekube-apiserver<\/h2>\n<p>\u7f16\u5199\/usr\/lib\/systemd\/system\/kube-apiserver.service\u6587\u4ef6\u3002CentOS\u4e2d\u7684service\u914d\u7f6e\u6587\u4ef6\u53c2\u8003<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs php has-numbering\">[Unit]\nDescription=Kubernetes API Service\nDocumentation=https:<span class=\"hljs-comment\">\/\/github.com\/GoogleCloudPlatform\/kubernetes<\/span>\nAfter=network.target\nAfter=etcd.service\n\n[Service]\nEnvironmentFile=-\/etc\/kubernetes\/config\nEnvironmentFile=-\/etc\/kubernetes\/apiserver\nExecStart=\/usr\/bin\/kube-apiserver \\\n        <span class=\"hljs-variable\">$KUBE_LOGTOSTDERR<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_LOG_LEVEL<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_ETCD_SERVERS<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_API_ADDRESS<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_API_PORT<\/span> \\\n        <span class=\"hljs-variable\">$KUBELET_PORT<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_ALLOW_PRIV<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_SERVICE_ADDRESSES<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_ADMISSION_CONTROL<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_API_ARGS<\/span>\nRestart=on-failure\nType=notify\nLimitNOFILE=<span class=\"hljs-number\">65536<\/span>\n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<li>26<\/li>\n<\/ul>\n<p>\u521b\u5efakubernetes\u7684\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\/etc\/kubernetes\u3002<\/p>\n<p>\u6dfb\u52a0config\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\">###<\/span>\n<span class=\"hljs-preprocessor\"># kubernetes system config<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\"># The following values are used to configure various aspects of all<\/span>\n<span class=\"hljs-preprocessor\"># kubernetes services, including<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">#   kube-apiserver.service<\/span>\n<span class=\"hljs-preprocessor\">#   kube-controller-manager.service<\/span>\n<span class=\"hljs-preprocessor\">#   kube-scheduler.service<\/span>\n<span class=\"hljs-preprocessor\">#   kubelet.service<\/span>\n<span class=\"hljs-preprocessor\">#   kube-proxy.service<\/span>\n<span class=\"hljs-preprocessor\"># logging to stderr means we get it in the systemd journal<\/span>\nKUBE_LOGTOSTDERR=<span class=\"hljs-string\">\"--logtostderr=true\"<\/span>\n\n<span class=\"hljs-preprocessor\"># journal message level, 0 is debug<\/span>\nKUBE_LOG_LEVEL=<span class=\"hljs-string\">\"--v=0\"<\/span>\n\n<span class=\"hljs-preprocessor\"># Should this cluster be allowed to run privileged docker containers<\/span>\nKUBE_ALLOW_PRIV=<span class=\"hljs-string\">\"--allow-privileged=false\"<\/span>\n\n<span class=\"hljs-preprocessor\"># How the controller-manager, scheduler, and proxy find the apiserver<\/span>\nKUBE_MASTER=<span class=\"hljs-string\">\"--master=http:\/\/sz-pg-oam-docker-test-001.tendcloud.com:8080\"<\/span>\n\u6dfb\u52a0apiserver\u914d\u7f6e\u6587\u4ef6\u3002\n\n<span class=\"hljs-preprocessor\">###<\/span>\n<span class=\"hljs-preprocessor\">## kubernetes system config<\/span>\n<span class=\"hljs-preprocessor\">##<\/span>\n<span class=\"hljs-preprocessor\">## The following values are used to configure the kube-apiserver<\/span>\n<span class=\"hljs-preprocessor\">##<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## The address on the local server to listen to.<\/span>\nKUBE_API_ADDRESS=<span class=\"hljs-string\">\"--address=sz-pg-oam-docker-test-001.tendcloud.com\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## The port on the local server to listen on.<\/span>\nKUBE_API_PORT=<span class=\"hljs-string\">\"--port=8080\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## Port minions listen on<\/span>\nKUBELET_PORT=<span class=\"hljs-string\">\"--kubelet-port=10250\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## Comma separated list of nodes in the etcd cluster<\/span>\nKUBE_ETCD_SERVERS=<span class=\"hljs-string\">\"--etcd-servers=http:\/\/127.0.0.1:2379\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## Address range to use for services<\/span>\nKUBE_SERVICE_ADDREKUBELET_POD_INFRA_CONTAINERSSES=<span class=\"hljs-string\">\"--service-cluster-ip-range=10.254.0.0\/16\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## default admission control policies<\/span>\nKUBE_ADMISSION_CONTROL=<span class=\"hljs-string\">\"--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## Add your own!<\/span>\n<span class=\"hljs-preprocessor\">#KUBE_API_ARGS=\"\"<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<li>25<\/li>\n<li>26<\/li>\n<li>27<\/li>\n<li>28<\/li>\n<li>29<\/li>\n<li>30<\/li>\n<li>31<\/li>\n<li>32<\/li>\n<li>33<\/li>\n<li>34<\/li>\n<li>35<\/li>\n<li>36<\/li>\n<li>37<\/li>\n<li>38<\/li>\n<li>39<\/li>\n<li>40<\/li>\n<li>41<\/li>\n<li>42<\/li>\n<li>43<\/li>\n<li>44<\/li>\n<li>45<\/li>\n<li>46<\/li>\n<li>47<\/li>\n<li>48<\/li>\n<li>49<\/li>\n<li>50<\/li>\n<\/ul>\n<p>\u2014admission-control\u53c2\u6570\u662fKubernetes\u7684\u5b89\u5168\u673a\u5236\u914d\u7f6e\uff0c\u8fd9\u4e9b\u5b89\u5168\u673a\u5236\u90fd\u662f\u4ee5\u63d2\u4ef6\u7684\u5f62\u5f0f\u7528\u6765\u5bf9API Serve\u8fdb\u884c\u51c6\u5165\u63a7\u5236\uff0c\u4e00\u5f00\u59cb\u6211\u4eec\u6ca1\u6709\u914d\u7f6eServiceAccount\uff0c\u8fd9\u662f\u4e3a\u4e86\u65b9\u4fbf\u96c6\u7fa4\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u4e0d\u9700\u8981\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u3002\u5982\u679c\u4f60\u9700\u8981\u66f4\u9ad8\u7ea7\u7684\u8eab\u4efd\u9a8c\u8bc1\u548c\u9274\u6743\u7684\u8bdd\u5c31\u9700\u8981\u52a0\u4e0a\u5b83\u4e86\u3002<\/p>\n<h2 id=\"\u914d\u7f6ekube-controller-manager\"><a name=\"t43\"><\/a>\u914d\u7f6ekube-controller-manager<\/h2>\n<p>\u7f16\u5199\/usr\/lib\/systemd\/system\/kube-controller.service\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs makefile has-numbering\"><span class=\"hljs-constant\">Description<\/span>=Kubernetes Controller Manager\n<span class=\"hljs-constant\">Documentation<\/span>=https:\/\/github.com\/GoogleCloudPlatform\/kubernetes\n\n[Service]\n<span class=\"hljs-constant\">EnvironmentFile<\/span>=-\/etc\/kubernetes\/config\n<span class=\"hljs-constant\">EnvironmentFile<\/span>=-\/etc\/kubernetes\/controller-manager\n<span class=\"hljs-constant\">ExecStart<\/span>=\/usr\/bin\/kube-controller-manager \\\n        $KUBE_LOGTOSTDERR \\\n        $KUBE_LOG_LEVEL \\\n        $KUBE_MASTER \\\n        $KUBE_CONTROLLER_MANAGER_ARGS\n<span class=\"hljs-constant\">Restart<\/span>=on-failure\n<span class=\"hljs-constant\">LimitNOFILE<\/span>=65536\n\n[Install]\n<span class=\"hljs-constant\">WantedBy<\/span>=multi-user.target<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<\/ul>\n<p>\u5728\/etc\/kubernetes\u76ee\u5f55\u4e0b\u6dfb\u52a0controller-manager\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\">###<\/span>\n<span class=\"hljs-preprocessor\"># The following values are used to configure the kubernetes controller-manager<\/span>\n\n<span class=\"hljs-preprocessor\"># defaults from config and apiserver should be adequate<\/span>\n\n<span class=\"hljs-preprocessor\"># Add your own!<\/span>\nKUBE_CONTROLLER_MANAGER_ARGS=<span class=\"hljs-string\">\"\"<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<\/ul>\n<h2 id=\"\u914d\u7f6ekube-scheduler\"><a name=\"t44\"><\/a>\u914d\u7f6ekube-scheduler<\/h2>\n<p>\u7f16\u5199\/usr\/lib\/systemd\/system\/kube-scheduler.service\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs makefile has-numbering\">[Unit]\n<span class=\"hljs-constant\">Description<\/span>=Kubernetes Scheduler Plugin\n<span class=\"hljs-constant\">Documentation<\/span>=https:\/\/github.com\/GoogleCloudPlatform\/kubernetes\n\n[Service]\n<span class=\"hljs-constant\">EnvironmentFile<\/span>=-\/etc\/kubernetes\/config\n<span class=\"hljs-constant\">EnvironmentFile<\/span>=-\/etc\/kubernetes\/scheduler\n<span class=\"hljs-constant\">ExecStart<\/span>=\/usr\/bin\/kube-scheduler \\\n        $KUBE_LOGTOSTDERR \\\n        $KUBE_LOG_LEVEL \\\n        $KUBE_MASTER \\\n        $KUBE_SCHEDULER_ARGS\n<span class=\"hljs-constant\">Restart<\/span>=on-failure\n<span class=\"hljs-constant\">LimitNOFILE<\/span>=65536\n\n[Install]\n<span class=\"hljs-constant\">WantedBy<\/span>=multi-user.target<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<\/ul>\n<p>\u5728\/etc\/kubernetes\u76ee\u5f55\u4e0b\u6dfb\u52a0scheduler\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\">###<\/span>\n<span class=\"hljs-preprocessor\"># kubernetes scheduler config<\/span>\n\n<span class=\"hljs-preprocessor\"># default config should be adequate<\/span>\n\n<span class=\"hljs-preprocessor\"># Add your own!<\/span>\nKUBE_SCHEDULER_ARGS=<span class=\"hljs-string\">\"\"<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<\/ul>\n<h2 id=\"\u914d\u7f6ekube-proxy\"><a name=\"t45\"><\/a>\u914d\u7f6ekube-proxy<\/h2>\n<p>\u7f16\u5199\/usr\/lib\/systemd\/system\/kube-proxy.service\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs makefile has-numbering\">[Unit]\n<span class=\"hljs-constant\">Description<\/span>=Kubernetes Kube-Proxy Server\n<span class=\"hljs-constant\">Documentation<\/span>=https:\/\/github.com\/GoogleCloudPlatform\/kubernetes\n<span class=\"hljs-constant\">After<\/span>=network.target\n\n[Service]\n<span class=\"hljs-constant\">EnvironmentFile<\/span>=-\/etc\/kubernetes\/config\n<span class=\"hljs-constant\">EnvironmentFile<\/span>=-\/etc\/kubernetes\/proxy\n<span class=\"hljs-constant\">ExecStart<\/span>=\/usr\/bin\/kube-proxy \\\n        $KUBE_LOGTOSTDERR \\\n        $KUBE_LOG_LEVEL \\\n        $KUBE_MASTER \\\n        $KUBE_PROXY_ARGS\n<span class=\"hljs-constant\">Restart<\/span>=on-failure\n<span class=\"hljs-constant\">LimitNOFILE<\/span>=65536\n\n[Install]\n<span class=\"hljs-constant\">WantedBy<\/span>=multi-user.target<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<\/ul>\n<p>\u5728\/etc\/kubernetes\u76ee\u5f55\u4e0b\u6dfb\u52a0proxy\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\">###<\/span>\n<span class=\"hljs-preprocessor\"># kubernetes proxy config<\/span>\n\n<span class=\"hljs-preprocessor\"># default config should be adequate<\/span>\n\n<span class=\"hljs-preprocessor\"># Add your own!<\/span>\nKUBE_PROXY_ARGS=<span class=\"hljs-string\">\"\"<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<\/ul>\n<h2 id=\"\u914d\u7f6ekubelet\"><a name=\"t46\"><\/a>\u914d\u7f6ekubelet<\/h2>\n<p>\u521b\u5efa\u914d\u7f6e<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs livecodeserver has-numbering\">\/usr\/lib\/systemd\/<span class=\"hljs-keyword\">system<\/span>\/kubelet.service<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u6587\u4ef6\u7684\u5185\u5bb9\u4e3a\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs php has-numbering\">[Unit]\nDescription=Kubernetes Kubelet Server\nDocumentation=https:<span class=\"hljs-comment\">\/\/github.com\/GoogleCloudPlatform\/kubernetes<\/span>\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nWorkingDirectory=\/<span class=\"hljs-keyword\">var<\/span>\/lib\/kubelet\nEnvironmentFile=-\/etc\/kubernetes\/config\nEnvironmentFile=-\/etc\/kubernetes\/kubelet\nExecStart=\/usr\/bin\/kubelet \\\n        <span class=\"hljs-variable\">$KUBE_LOGTOSTDERR<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_LOG_LEVEL<\/span> \\\n        <span class=\"hljs-variable\">$KUBELET_API_SERVER<\/span> \\\n        <span class=\"hljs-variable\">$KUBELET_ADDRESS<\/span> \\\n        <span class=\"hljs-variable\">$KUBELET_PORT<\/span> \\\n        <span class=\"hljs-variable\">$KUBELET_HOSTNAME<\/span> \\\n        <span class=\"hljs-variable\">$KUBE_ALLOW_PRIV<\/span> \\\n        <span class=\"hljs-variable\">$KUBELET_POD_INFRA_CONTAINER<\/span> \\\n        <span class=\"hljs-variable\">$KUBELET_ARGS<\/span>\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<li>21<\/li>\n<li>22<\/li>\n<li>23<\/li>\n<li>24<\/li>\n<\/ul>\n<p>\u5728\/etc\/kubernetes\u76ee\u5f55\u4e0b\u6dfb\u52a0kubelet\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs vala has-numbering\"><span class=\"hljs-preprocessor\">###<\/span>\n<span class=\"hljs-preprocessor\">## kubernetes kubelet (minion) config<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## The address for the info server to serve on (set to 0.0.0.0 or \"\" for all interfaces)<\/span>\nKUBELET_ADDRESS=<span class=\"hljs-string\">\"--address=0.0.0.0\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## The port for the info server to serve on<\/span>\nKUBELET_PORT=<span class=\"hljs-string\">\"--port=10250\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## You may leave this blank to use the actual hostname<\/span>\nKUBELET_HOSTNAME=<span class=\"hljs-string\">\"--hostname-override=sz-pg-oam-docker-test-001.tendcloud.com\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## location of the api-server<\/span>\nKUBELET_API_SERVER=<span class=\"hljs-string\">\"--api-servers=http:\/\/sz-pg-oam-docker-test-001.tendcloud.com:8080\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## pod infrastructure container<\/span>\nKUBELET_POD_INFRA_CONTAINER=<span class=\"hljs-string\">\"--pod-infra-container-image=registry.access.redhat.com\/rhel7\/pod-infrastructure:latest\"<\/span>\n<span class=\"hljs-preprocessor\">#<\/span>\n<span class=\"hljs-preprocessor\">## Add your own!<\/span>\nKUBELET_ARGS=<span class=\"hljs-string\">\"\"<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<li>9<\/li>\n<li>10<\/li>\n<li>11<\/li>\n<li>12<\/li>\n<li>13<\/li>\n<li>14<\/li>\n<li>15<\/li>\n<li>16<\/li>\n<li>17<\/li>\n<li>18<\/li>\n<li>19<\/li>\n<li>20<\/li>\n<\/ul>\n<p>\u26a0\ufe0fKUBELET_POD_INFRA_CONTAINER\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u914d\u7f6e\u6210\u81ea\u5df1\u79c1\u6709\u4ed3\u5e93\u91cc\u7684image\u3002<\/p>\n<h2 id=\"node\u8282\u70b9\u914d\u7f6e\"><a name=\"t47\"><\/a>Node\u8282\u70b9\u914d\u7f6e<\/h2>\n<p>Node\u8282\u70b9\u9700\u8981\u914d\u7f6e\uff1a<\/p>\n<p>kube-proxy<br \/>\nkubectl<br \/>\nkube-proxy\u7684\u914d\u7f6e\u4e0emaster\u8282\u70b9\u7684kube-proxy\u914d\u7f6e\u76f8\u540c\u3002<\/p>\n<p>kubectl\u7684\u914d\u7f6e\u9700\u8981\u4fee\u6539KUBELET_HOST\u4e3a\u672c\u673a\u7684hostname\uff0c\u5176\u5b83\u914d\u7f6e\u76f8\u540c\u3002<\/p>\n<h2 id=\"\u542f\u52a8\"><a name=\"t48\"><\/a>\u542f\u52a8<\/h2>\n<p>\u5728Master\u8282\u70b9\u4e0a\u6267\u884c\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">for SERVICES <span class=\"hljs-keyword\">in<\/span> etcd kube<span class=\"hljs-attribute\">-apiserver<\/span> kube<span class=\"hljs-attribute\">-controller<\/span><span class=\"hljs-attribute\">-manager<\/span> kube<span class=\"hljs-attribute\">-scheduler<\/span> kube<span class=\"hljs-attribute\">-proxy<\/span> kubelet flanneld; <span class=\"hljs-keyword\">do<\/span>\n    systemctl restart <span class=\"hljs-variable\">$SERVICES<\/span>\n    systemctl enable <span class=\"hljs-variable\">$SERVICES<\/span>\n    systemctl status <span class=\"hljs-variable\">$SERVICES<\/span>\ndone<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<\/ul>\n<p>\u5728\u53e6\u5916\u4e24\u53f0Node\u8282\u70b9\u4e0a\u6267\u884c\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-keyword\">for<\/span> SERVICES <span class=\"hljs-keyword\">in<\/span> kube-proxy kubelet flanneld; <span class=\"hljs-keyword\">do<\/span>\n    systemctl restart <span class=\"hljs-variable\">$SERVICES<\/span>\n    systemctl enable <span class=\"hljs-variable\">$SERVICES<\/span>\n    systemctl status <span class=\"hljs-variable\">$SERVICES<\/span>\n<span class=\"hljs-keyword\">done<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<\/ul>\n<h2 id=\"\u9a8c\u8bc1\"><a name=\"t49\"><\/a>\u9a8c\u8bc1<\/h2>\n<p>\u5728Master\u8282\u70b9\u4e0a\u8fd0\u884c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\"><span class=\"hljs-variable\">$kubectl<\/span> get <span class=\"hljs-literal\">all<\/span>\nNAME             CLUSTER<span class=\"hljs-attribute\">-IP<\/span>   EXTERNAL<span class=\"hljs-attribute\">-IP<\/span>   PORT(S)   AGE\nsvc\/kubernetes   <span class=\"hljs-number\">10.254<\/span><span class=\"hljs-number\">.0<\/span><span class=\"hljs-number\">.1<\/span>   <span class=\"hljs-subst\">&lt;<\/span><span class=\"hljs-literal\">none<\/span><span class=\"hljs-subst\">&gt;<\/span>        <span class=\"hljs-number\">443<\/span>\/TCP   <span class=\"hljs-number\">1<\/span>h\n<span class=\"hljs-variable\">$kubectl<\/span> get nodes\nNAME                                      STATUS    AGE       VERSION\nsz<span class=\"hljs-attribute\">-pg<\/span><span class=\"hljs-attribute\">-oam<\/span><span class=\"hljs-attribute\">-docker<\/span><span class=\"hljs-attribute\">-test<\/span><span class=\"hljs-subst\">-<\/span><span class=\"hljs-number\">001.<\/span>tendcloud<span class=\"hljs-built_in\">.<\/span>com   Ready     <span class=\"hljs-number\">7<\/span>m        v1<span class=\"hljs-number\">.6<\/span><span class=\"hljs-number\">.0<\/span>\nsz<span class=\"hljs-attribute\">-pg<\/span><span class=\"hljs-attribute\">-oam<\/span><span class=\"hljs-attribute\">-docker<\/span><span class=\"hljs-attribute\">-test<\/span><span class=\"hljs-subst\">-<\/span><span class=\"hljs-number\">002.<\/span>tendcloud<span class=\"hljs-built_in\">.<\/span>com   Ready     <span class=\"hljs-number\">4<\/span>m        v1<span class=\"hljs-number\">.6<\/span><span class=\"hljs-number\">.0<\/span>\nsz<span class=\"hljs-attribute\">-pg<\/span><span class=\"hljs-attribute\">-oam<\/span><span class=\"hljs-attribute\">-docker<\/span><span class=\"hljs-attribute\">-test<\/span><span class=\"hljs-subst\">-<\/span><span class=\"hljs-number\">003.<\/span>tendcloud<span class=\"hljs-built_in\">.<\/span>com   Ready     <span class=\"hljs-number\">10<\/span>s       v1<span class=\"hljs-number\">.6<\/span><span class=\"hljs-number\">.0<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<li>8<\/li>\n<\/ul>\n<p>\u73b0\u5728\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u5566\u3002<\/p>\n<h1 id=\"kubeadm-\u751f\u6210\u7684token\u8fc7\u671f\u540e\u96c6\u7fa4\u589e\u52a0\u8282\u70b9\"><a name=\"t50\"><\/a>kubeadm \u751f\u6210\u7684token\u8fc7\u671f\u540e\uff0c\u96c6\u7fa4\u589e\u52a0\u8282\u70b9<\/h1>\n<p>\u89e3\u51b3\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>\u91cd\u65b0\u751f\u6210\u65b0\u7684token<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs haskell has-numbering\">[root@walker-<span class=\"hljs-number\">1<\/span> kubernetes]# kubeadm token create\n[kubeadm] <span class=\"hljs-type\">WARNING<\/span>: starting <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-number\">1.8<\/span>, tokens expire after <span class=\"hljs-number\">24<\/span> hours by <span class=\"hljs-default\"><span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-container\">(<span class=\"hljs-title\">if<\/span> <span class=\"hljs-title\">you<\/span> <span class=\"hljs-title\">require<\/span> <span class=\"hljs-title\">a<\/span> <span class=\"hljs-title\">non<\/span>-<span class=\"hljs-title\">expiring<\/span> <span class=\"hljs-title\">token<\/span> <span class=\"hljs-title\">use<\/span> <span class=\"hljs-comment\">--ttl 0)<\/span>\n<span class=\"hljs-title\">aa78f6<\/span>.8<span class=\"hljs-title\">b4cafc8ed26c34f<\/span>\n[<span class=\"hljs-title\">root<\/span>@<span class=\"hljs-title\">walker<\/span>-1 <span class=\"hljs-title\">kubernetes<\/span>]# <span class=\"hljs-title\">kubeadm<\/span> <span class=\"hljs-title\">token<\/span> <span class=\"hljs-title\">list<\/span>\n<span class=\"hljs-type\">TOKEN<\/span>                     <span class=\"hljs-type\">TTL<\/span>       <span class=\"hljs-type\">EXPIRES<\/span>                     <span class=\"hljs-type\">USAGES<\/span>                   <span class=\"hljs-type\">DESCRIPTION<\/span>   <span class=\"hljs-type\">EXTRA<\/span> <span class=\"hljs-type\">GROUPS<\/span>\n<span class=\"hljs-title\">aa78f6<\/span>.8<span class=\"hljs-title\">b4cafc8ed26c34f<\/span>   23<span class=\"hljs-title\">h<\/span>       2017-12-26T16:36:29+08:00   <span class=\"hljs-title\">authentication<\/span>,<span class=\"hljs-title\">signing<\/span>   &lt;<span class=\"hljs-title\">none<\/span>&gt;        <span class=\"hljs-title\">system<\/span>:<span class=\"hljs-title\">bootstrappers<\/span>:<span class=\"hljs-title\">kubeadm<\/span>:<span class=\"hljs-title\">default<\/span>-<span class=\"hljs-title\">node<\/span>-<span class=\"hljs-title\">token<\/span><\/span><\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<\/ul>\n<p>\u83b7\u53d6ca\u8bc1\u4e66sha256\u7f16\u7801hash\u503c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs javascript has-numbering\">[root@walker-<span class=\"hljs-number\">1<\/span> kubernetes]# openssl x509 -pubkey -<span class=\"hljs-keyword\">in<\/span> \/etc\/kubernetes\/pki\/ca.crt | openssl rsa -pubin -outform der <span class=\"hljs-number\">2<\/span>&gt;<span class=\"hljs-regexp\">\/dev\/<\/span><span class=\"hljs-literal\">null<\/span> | openssl dgst -sha256 -hex | sed <span class=\"hljs-string\">'s\/^.* \/\/'<\/span>\n<span class=\"hljs-number\">0<\/span>fd95a9bc67a7bf0ef42da968a0d55d92e52898ec37c971bd77ee501d845b538<\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<li>2<\/li>\n<\/ul>\n<p>\u8282\u70b9\u52a0\u5165\u96c6\u7fa4<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs brainfuck has-numbering\"><span class=\"hljs-title\">[<\/span><span class=\"hljs-comment\">root@walker<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">4<\/span> <span class=\"hljs-comment\">kubernetes<\/span><span class=\"hljs-title\">]<\/span><span class=\"hljs-comment\">#<\/span> <span class=\"hljs-comment\">kubeadm<\/span> <span class=\"hljs-comment\">join<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">token<\/span> <span class=\"hljs-comment\">aa78f6<\/span><span class=\"hljs-string\">.<\/span><span class=\"hljs-comment\">8b4cafc8ed26c34f<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">discovery<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">token<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">ca<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">cert<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">hash<\/span> <span class=\"hljs-comment\">sha256:0fd95a9bc67a7bf0ef42da968a0d55d92e52898ec37c971bd77ee501d845b538<\/span>  <span class=\"hljs-comment\">172<\/span><span class=\"hljs-string\">.<\/span><span class=\"hljs-comment\">16<\/span><span class=\"hljs-string\">.<\/span><span class=\"hljs-comment\">6<\/span><span class=\"hljs-string\">.<\/span><span class=\"hljs-comment\">79:6443<\/span> <span class=\"hljs-literal\">-<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">skip<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">preflight<\/span><span class=\"hljs-literal\">-<\/span><span class=\"hljs-comment\">checks<\/span><\/code><\/pre>\n<ul class=\"pre-numbering\">\n<li>1<\/li>\n<\/ul>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904:<a title=\"kubernetes---CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248\" href=\"http:\/\/www.525.life\/article?id=1510739742331\" target=\"_blank\" rel=\"nofollow noopener\">kubernetes\u2014CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248<\/a><\/p>\n<h1 id=\"\u5176\u4ed6\u53c2\u8003\u94fe\u63a5\"><a name=\"t51\"><\/a>\u5176\u4ed6\u53c2\u8003\u94fe\u63a5<\/h1>\n<p>\u5b98\u65b9\u5b89\u88c5\u6587\u6863\u53ef\u4ee5\u53c2\u8003 <a href=\"https:\/\/kubernetes.io\/docs\/setup\/independent\/install-kubeadm\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/kubernetes.io\/docs\/setup\/independent\/install-kubeadm\/<\/a><\/p>\n<p><a title=\"\u5728CentOS\u4e0a\u5b89\u88c5kubernetes\u8be6\u7ec6\u6307\u5357\" href=\"https:\/\/jimmysong.io\/posts\/kubernetes-installation-on-centos\/\" target=\"_blank\" rel=\"nofollow noopener\">\u5728CentOS\u4e0a\u5b89\u88c5kubernetes\u8be6\u7ec6\u6307\u5357<\/a><\/p>\n<p><a title=\"\u4f7f\u7528kubeadm\u5728CentOS 7\u4e0a\u5b89\u88c5Kubernetes 1.8\" href=\"https:\/\/www.zybuluo.com\/ncepuwanghui\/note\/953929\" target=\"_blank\" rel=\"nofollow noopener\">\u4f7f\u7528kubeadm\u5728CentOS 7\u4e0a\u5b89\u88c5Kubernetes 1.8<\/a><\/p>\n<p><a title=\"\u4f7f\u7528kubeadm\u5b89\u88c5Kubernetes 1.9\" href=\"https:\/\/blog.frognew.com\/2017\/12\/kubeadm-install-kubernetes-1.9.html#11%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE\" target=\"_blank\" rel=\"nofollow noopener\">\u4f7f\u7528kubeadm\u5b89\u88c5Kubernetes 1.9<\/a><\/p>\n<p><a title=\"CentOS\u90e8\u7f72\u5355\u70b9Kubernetes\u96c6\u7fa4\" href=\"https:\/\/www.kubernetes.org.cn\/doc-16\" target=\"_blank\" rel=\"nofollow noopener\">CentOS\u90e8\u7f72\u5355\u70b9Kubernetes\u96c6\u7fa4<\/a><\/p>\n<p><a title=\"Ubuntu\u7269\u7406\u8282\u70b9\u4e0a\u90e8\u7f72Kubernets\u96c6\u7fa4\" href=\"https:\/\/www.kubernetes.org.cn\/doc-17\" target=\"_blank\" rel=\"nofollow noopener\">Ubuntu\u7269\u7406\u8282\u70b9\u4e0a\u90e8\u7f72Kubernets\u96c6\u7fa4<\/a><\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904:<a title=\"kubernetes---CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248\" href=\"http:\/\/www.525.life\/article?id=1510739742331\" target=\"_blank\" rel=\"nofollow noopener\">kubernetes\u2014CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248<\/a><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; \u4f5c\u8005\uff1a\u5f20\u5c0f\u51e1vip \u6765\u6e90\uff1aCSDN \u539f\u6587\uff1ahttps:\/\/blog.csdn.net\/zzq900503\/article\/details\/81710319?utm_source=copy \u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u535a\u6587\u94fe\u63a5\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904:kubernetes\u2014CentOS7\u5b89\u88c5kubernetes1.11.2\u56fe\u6587\u5b8c\u6574\u7248 \u67b6\u6784\u89c4\u5212 k8s\u81f3\u5c11\u9700\u8981\u4e00\u4e2amaster\u548c\u4e00\u4e2anode\u624d\u80fd\u7ec4\u6210\u4e00\u4e2a\u53ef\u7528\u96c6\u7fa4\u3002 \u672c\u7ae0\u6211\u4eec\u642d\u5efa\u4e00\u4e2amaster\u8282\u70b9\u548c\u4e09\u4e2anode\u8282\u70b9\u3002 \u6211\u4eec\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u65f6k8s\u65f6\u53ef\u4ee5\u9002\u5f53\u589e\u52a0\u8282\u70b9\u3002 \u6211\u4eec\u6709\u4e09\u53f0\u670d\u52a1\u5668\uff0cip\u548c\u8eab\u4efd\u89c4\u5212\u5982\u4e0b: 192.168.11.90 master node 192.168.11.91 node 192.168.11.92 node 192.168.11.90\u5373\u4f5cmaster\u8282\u70b9\u53c8\u4f5cnode\u8282\u70b9\u3002 \u4e09\u53f0\u670d\u52a1\u5668\u90fd\u662fCentOS7\u7cfb\u7edf\u3002 \u6ce8\u610f\uff1aKubernetes \u51e0\u4e4e\u6240\u6709\u7684\u5b89\u88c5\u7ec4\u4ef6\u548c Docker \u955c\u50cf\u90fd\u653e\u5728 goolge [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1043","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1043"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/1043\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}