{"id":110,"date":"2017-03-30T15:39:39","date_gmt":"2017-03-30T07:39:39","guid":{"rendered":"http:\/\/www.jsjs.org\/?p=110"},"modified":"2017-03-30T15:39:39","modified_gmt":"2017-03-30T07:39:39","slug":"%e4%b8%80%e7%af%87%e6%96%87%e7%ab%a0%e5%b8%a6%e4%bd%a0%e4%ba%86%e8%a7%a3kubernetes%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=110","title":{"rendered":"\u4e00\u7bc7\u6587\u7ae0\u5e26\u4f60\u4e86\u89e3Kubernetes\u5b89\u88c5"},"content":{"rendered":"<p>http:\/\/tonybai.com\/2016\/10\/18\/learn-how-to-install-kubernetes-on-ubuntu\/<\/p>\n<p>&nbsp;<\/p>\n<p>\u7531\u4e8e\u4e4b\u524d\u5728\u963f\u91cc\u4e91\u4e0a\u90e8\u7f72\u7684<a href=\"http:\/\/tonybai.com\/2016\/10\/11\/some-problems-under-swarm-mode-in-docker-1-12\/\">Docker 1.12.2\u7684Swarm\u96c6\u7fa4<\/a>\u6ca1\u80fd\u6b63\u5e38\u5c55\u793a\u51fa\u5176\u6240\u5ba3\u79f0\u7684Routing mesh\u548cVIP\u7b49\u529f\u80fd\uff0c\u4e3a\u4e86\u6ee1\u8db3\u9879\u76ee\u9700\u8981\uff0c\u6211\u4eec\u53ea\u80fd\u8f6c\u5411\u53e6\u5916\u4e00\u79cd\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u548c\u670d\u52a1\u7f16\u6392\u5de5\u5177<a href=\"http:\/\/kubernetes.io\/\">Kubernetes<\/a>\u3002<\/p>\n<blockquote><p><em>\u6ce8\uff1a\u4e4b\u524dDocker1.12\u96c6\u7fa4\u7684Routing mesh\u548cVIP\u529f\u80fd\u5931\u6548\u7684\u95ee\u9898\uff0c\u7ecf\u8fc7\u5728github\u4e0a<a href=\"https:\/\/github.com\/docker\/docker\/issues\/26946\">\u4e0eDocker\u5f00\u53d1\u4eba\u5458\u7684\u6c9f\u901a<\/a>\uff0c\u76ee\u524d\u5df2\u7ecf\u5c06\u95ee\u9898\u539f\u56e0\u7f29\u5c0f\u5728\u963f\u91cc\u4e91\u7684\u7f51\u7edc\u4e0a\u9762\uff0c\u76ee\u524d\u770b\u662f\u7528\u4e8e\u627f\u8f7dvxlan\u6570\u636e\u901a\u4fe1\u7684\u8282\u70b94789 UDP\u7aef\u53e3\u4e0d\u901a\u7684\u95ee\u9898\uff0c\u9488\u5bf9\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u6b63\u5728\u901a\u8fc7\u963f\u91cc\u4e91\u552e\u540e\u5de5\u7a0b\u5e08\u505a\u8fdb\u4e00\u6b65\u6c9f\u901a\uff0c\u5e0c\u671b\u80fd\u627e\u51fa\u771f\u56e0\u3002<\/em><\/p><\/blockquote>\n<p>Kubernetes(\u4ee5\u4e0b\u79f0k8s)\u662fGoogle\u5f00\u6e90\u7684\u4e00\u6b3e\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u5de5\u5177\uff0c\u662fGoogle\u5185\u90e8\u5de5\u5177Borg\u7684\u201c\u5f00\u6e90\u7248\u201d\u3002\u80cc\u9760Google\u8fd9\u4e2a\u9ad8\u5927\u4e0a\u7684\u4eb2\u7239\uff0ck8s\u4e00\u51fa\u751f\u5c31\u5438\u5f15\u4e86\u8db3\u591f\u7684\u773c\u7403\uff0c\u5e76\u5f97\u5230\u4e86\u8bf8\u591a\u77e5\u540dIT\u516c\u53f8\u7684\u652f\u6301\u3002\u81f3\u4e8eGoogle\u5f00\u6e90k8s\u7684\u521d\u8877\uff0c\u7f8e\u597d\u7684\u8bf4\u6cd5\u662fGoogle\u5e0c\u671b\u901a\u8fc7\u8f93\u51fa\u81ea\u5df1\u5728\u5bb9\u5668\u9886\u57df\u957f\u8fbe10\u591a\u5e74\u7684\u4e30\u5bcc\u7ecf\u9a8c\uff0c\u5e2e\u52a9\u5bb9\u5668\u9886\u57df\u7684\u5f00\u53d1\u4eba\u5458\u548c\u5ba2\u6237\u63d0\u5347\u5f00\u53d1\u6548\u7387\u548c\u5bb9\u5668\u7ba1\u7406\u7684\u6863\u6b21\u3002\u4f46\u4efb\u4f55\u4e00\u79cd\u516c\u53f8\u884c\u4e3a\u90fd\u4f1a\u6709\u5176\u80cc\u540e\u7684\u77ed\u671f\u6216\u957f\u671f\u7684\u5546\u4e1a\u76ee\u7684\uff0cGoogle\u4f5c\u4e3a\u4e00\u4e2a\u5546\u4e1a\u516c\u53f8\u4e5f\u4e0d\u4f1a\u4f8b\u5916\u3002Google\u63a8\u51fak8s\u5230\u5e95\u4e3a\u5565\u5462\uff1f\u4f17\u8bf4\u7eb7\u7ead\u3002\u4e00\u79cd\u8bf4\u6cd5\u662fGoogle\u901a\u8fc7k8s\u8f93\u51fa\u5176\u5bb9\u5668\u5de5\u5177\u7684\u64cd\u4f5c\u548c\u4f7f\u7528\u65b9\u6cd5\u3001API\u6807\u51c6\u7b49\uff0c\u4e3a\u5168\u4e16\u754c\u7684\u5f00\u53d1\u4eba\u5458\u4f7f\u7528\u5176\u516c\u6709\u5bb9\u5668\u9884\u70ed\u5e76\u63d0\u4f9b\u201c\u96f6\u95e8\u69db\u201d\u4f53\u9a8c\u3002<\/p>\n<p>k8s\u76ee\u524d\u662f\u516c\u8ba4\u7684\u6700\u5148\u8fdb\u7684\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u5de5\u5177\uff0c\u57281.0\u7248\u672c\u53d1\u5e03\u540e\uff0ck8s\u7684\u53d1\u5c55\u901f\u5ea6\u66f4\u52a0\u8fc5\u731b\uff0c\u5e76\u4e14\u5f97\u5230\u4e86\u5bb9\u5668\u751f\u6001\u5708\u5382\u5546\u7684\u5168\u529b\u652f\u6301\uff0c\u8fd9\u5305\u62ec<a href=\"https:\/\/coreos.com\/\">coreos<\/a>\u3001<a href=\"http:\/\/tonybai.com\/2016\/04\/14\/an-introduction-about-rancher\/\">rancher<\/a>\u7b49\uff0c\u8bf8\u591a\u63d0\u4f9b\u516c\u6709\u4e91\u670d\u52a1\u7684\u5382\u5546\u5728\u63d0\u4f9b\u5bb9\u5668\u670d\u52a1\u65f6\u4e5f\u90fd\u57fa\u4e8ek8s\u505a\u4e8c\u6b21\u5f00\u53d1\u6765\u63d0\u4f9b\u57fa\u7840\u8bbe\u65bd\u5c42\u7684\u652f\u6491\uff0c\u6bd4\u5982\u534e\u4e3a\u3002\u53ef\u4ee5\u8bf4k8s\u4e5f\u662fDocker\u8fdb\u519b\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u548c\u670d\u52a1\u7f16\u6392\u9886\u57df\u6700\u4e3a\u5f3a\u52b2\u7684\u7ade\u4e89\u5bf9\u624b\u3002<\/p>\n<p>\u4e0d\u8fc7\u548c\u5df2\u7ecf\u539f\u751f\u96c6\u6210\u4e86\u96c6\u7fa4\u7ba1\u7406\u5de5\u5177swarmkit\u7684Docker\u76f8\u6bd4\uff0ck8s\u5728\u6587\u6863\u3001\u5b89\u88c5\u548c\u96c6\u7fa4\u7ba1\u7406\u65b9\u9762\u7684\u4f53\u9a8c\u8fd8\u6709\u5f88\u5927\u7684\u63d0\u5347\u7a7a\u95f4\u3002k8s\u6700\u65b0\u53d1\u5e03\u7684<a href=\"http:\/\/blog.kubernetes.io\/2016\/09\/kubernetes-1.4-making-it-easy-to-run-on-kuberentes-anywhere.html\">1.4\u7248\u672c<\/a>\u5c31\u662f\u4e00\u4e2a\u7740\u91cd\u5728\u8fd9\u4e9b\u65b9\u9762\u8fdb\u884c\u6539\u5584\u7684\u7248\u672c\u3002\u6bd4\u59821.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>\u4f46\u5bf9\u4e8e1.4\u7248\u672c\u4ee5\u524d\u76841.3.x\u7248\u672c\u6765\u8bf4\uff0c\u5b89\u88c5\u8d77\u6765\u7684\u8d76\u811a\u7528\u6700\u8fd1\u6d41\u884c\u7684\u7f51\u7edc\u8bcd\u6c47\u6765\u5f62\u5bb9\u5c31\u662f\u201c\u84dd\u7626\uff0c\u9999\u83c7\u201d\uff0c\u4f46\u6709\u4e9b\u65f6\u5019\u6211\u4eec\u8fd8\u4e0d\u5f97\u4e0d\u53bb\u6311\u6218\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u672c\u6587\u8981\u5e26\u5927\u5bb6\u4e86\u89e3\u7684\u5c31\u662f\u5229\u7528<a href=\"https:\/\/www.aliyun.com\/\">\u963f\u91cc\u4e91<\/a>\u56fd\u5185\u533a\u7684ECS\u4e3b\u673a\uff0c\u5728<a href=\"http:\/\/tonybai.com\/tag\/ubuntu\">Ubuntu 14.04.4<\/a>\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5<a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/releases\/tag\/v1.3.7\">k8s 1.3.7\u7248\u672c<\/a>\u7684\u65b9\u6cd5\u548c\u5b89\u88c5\u8fc7\u7a0b\u3002<\/p>\n<h4>\u96f6\u3001\u5fc3\u7406\u5efa\u8bbe<\/h4>\n<p>\u7531\u4e8ek8s\u662fGoogle\u51fa\u54c1\uff0c\u5f88\u591a\u7ec4\u4ef6\u4e0egoogle\u662f\u201c\u6253\u65ad\u4e86\u9aa8\u5934\u8fd8\u8fde\u7740\u7b4b\u201d\uff0c\u56e0\u6b64\u5728\u56fd\u5185\u7f51\u7edc\u4e2d\u5b89\u88c5k8s\u662f\u9700\u8981\u5148\u8fdb\u884c\u5fc3\u7406\u5efa\u8bbe\u7684^_^\uff0c\u56e0\u4e3a\u548c\u6587\u6863\u4e2d\u5ba3\u79f0\u7684k8s 1.4\u7248\u7684\u5b89\u88c5\u6216docker 1.12.x\u7684\u5b89\u88c5\u76f8\u6bd4\uff0ck8s 1.3.7\u7248\u672c\u7684\u5b89\u88c5\u7b80\u76f4\u5c31\u662f\u201c\u707e\u96be\u7ea7\u201d\u7684\u3002<\/p>\n<p>\u8981\u60f3\u8ba9\u8fd9\u4e00\u8fc7\u7a0b\u9002\u5f53\u987a\u5229\u4e00\u4e9b\uff0c\u6211\u4eec\u5fc5\u987b\u51c6\u5907\u4e00\u4e2a\u201c\u52a0\u901f\u5668\uff08\u4f60\u61c2\u7684\uff09\u201d\u3002\u5229\u7528\u52a0\u901f\u5668\u5e94\u5bf9\u4e09\u4ef6\u4e8b\uff1a\u6162\u3001\u65ad\u548c\u65e0\u6cd5\u8fde\u63a5\u3002<\/p>\n<ul>\n<li>\u6162\uff1a\u56fd\u5185\u4ecegithub\u6216\u5176\u4ed6\u56fd\u5916\u516c\u6709\u4e91\u4e0a\u4e0b\u4e1c\u897f\u7b80\u76f4\u592a\u6162\u4e86\uff0c\u7a0d\u5927\u4e00\u4e9b\u7684\u6587\u4ef6\uff0c\u901a\u5e38\u90fd\u662f\u51e0\u4e2a\u5c0f\u65f6\u6216\u662f10\u51e0\u4e2a\u5c0f\u65f6\u3002<\/li>\n<li>\u65ad\uff1a\u4f60\u8bf4\u6162\u5c31\u7b97\u4e86\uff0c\u8fd8\u603b\u65ad\u3002\u65ad\u4e86\u4e4b\u540e\uff0c\u9047\u5230\u4e0d\u652f\u6301\u65ad\u70b9\u7eed\u4f20\u7684\uff0c\u4e00\u5207\u8fd8\u5f97\u91cd\u6765\u3002\u52a8\u4e0d\u52a8\u5c31\u4e0aG\u7684\u6587\u4ef6\uff0c\u91cd\u6765\u7684\u65f6\u95f4\u6210\u672c\u662f\u6211\u4eec\u65e0\u6cd5\u627f\u53d7\u7684\u3002<\/li>\n<li>\u65e0\u6cd5\u8fde\u63a5\uff1a\u8fd9\u4e2a\u4f60\u77e5\u9053\u7684\uff0c\u5f88\u591a\u6258\u7ba1\u5728google\u540d\u4e0b\u7684\u4e1c\u897f\uff0c\u4f60\u603b\u662f\u65e0\u6cd5\u4e0b\u8f7d\u7684\u3002<\/li>\n<\/ul>\n<p>\u603b\u800c\u8a00\u4e4b\uff0ck8s\u7684\u5b89\u88c5\u548c\u5bb9\u5668\u96c6\u7fa4\u7684\u642d\u5efa\u8fc7\u7a0b\u662f\u4e00\u4e2a\u201c\u6f2b\u957f\u201d\u4e14\u53ef\u80fd\u53cd\u590d\u7684\u8fc7\u7a0b\uff0c\u9700\u8981\u505a\u597d\u5fc3\u7406\u51c6\u5907\u3002<\/p>\n<p>BTW\uff0c\u6211\u5728\u5b89\u88c5\u8fc7\u7a0b\u4f7f\u7528\u7684 \u7f51\u53cb<a href=\"http:\/\/weibo.com\/p\/1005051016825817\">noah_\u6628\u591c\u661f\u8fb0<\/a>\u63a8\u8350\u7684<a href=\"https:\/\/duotai.org\/\">\u591a\u6001<\/a>\u52a0\u901f\u5668\uff0c\u53ea\u9700\u914d\u7f6e\u4e00\u4e2ahttp_proxy\u5373\u53ef\uff0c\u5c24\u5176\u9002\u5408\u670d\u52a1\u5668\u540e\u53f0\u52a0\u901f\uff0c\u975e\u5e38\u65b9\u4fbf\uff0c\u901f\u5ea6\u4e5f\u5f88\u597d\u3002<\/p>\n<h4>\u4e00\u3001\u5b89\u88c5\u6a21\u578b<\/h4>\n<p>k8s\u7684\u6587\u6863\u4e0d\u53ef\u8c13\u4e0d\u4e30\u5bcc\uff0c\u5c24\u5176\u5728k8s\u5b89\u88c5\u8fd9\u4e2a\u73af\u8282\uff0ck8s\u63d0\u4f9b\u4e86\u9488\u5bf9\u5404\u79cd\u4e91\u5e73\u53f0\u3001\u88f8\u673a\u3001\u5404\u7c7bOS\u751a\u81f3\u5404\u7c7bcluster network model\u5b9e\u73b0\u7684<a href=\"http:\/\/kubernetes.io\/docs\/getting-started-guides\/\">\u5b89\u88c5\u6587\u6863<\/a>\uff0c\u4f60\u7740\u5b9e\u5f97\u8d39\u529b\u6311\u9009\u4e00\u4e2a\u6700\u9002\u5408\u81ea\u5df1\u60c5\u51b5\u7684\u3002<\/p>\n<p>\u7531\u4e8e\u76ee\u524d\u56fd\u5185\u963f\u91cc\u4e91\u5c1a\u672a\u63d0\u4f9b<a href=\"https:\/\/wiki.ubuntu.com\/XenialXerus\/ReleaseNotes\">Ubuntu 16.04LTS<\/a>\u7248\u672c\u865a\u62df\u673a\u955c\u50cf\uff08\u901a\u8fc7apt-get install\u53ef\u76f4\u63a5\u5b89\u88c5\u6700\u65b01.4.x\u7248\u672ck8s\uff09\uff0c\u6211\u4eec\u53ea\u80fd\u7528ubuntu 14.04.x\u6765\u5b89\u88c5k8s 1.3.x\u7248\u672c\uff0ck8s 1.4\u7248\u672c\u4f7f\u7528\u4e86systemd\u7684\u76f8\u5173\u7ec4\u4ef6\uff0c\u5728ubuntu 14.04.x\u4e0a\u624b\u5de5\u5b89\u88c5k8s 1.4\u96be\u5ea6\u4f30\u8ba1\u5c06\u662f\u201c\u5730\u72f1\u7ea7\u201d\u7684\u3002\u7f51\u7edc\u6a21\u578b\u5b9e\u73b0\u6211\u9009\u62e9coreos\u63d0\u4f9b\u7684<a href=\"https:\/\/github.com\/coreos\/flannel\">flannel<\/a>\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u53c2\u8003\u7684\u662f\u7531\u56fd\u5185\u6d59\u5927\u56e2\u961f\u7ef4\u62a4\u7684<a href=\"http:\/\/kubernetes.io\/docs\/getting-started-guides\/ubuntu\">\u8fd9\u4efdk8s\u5b89\u88c5\u6587\u6863<\/a>\u3002\u6d59\u5927\u7684\u8fd9\u4efd\u5b89\u88c5\u6587\u6863\u9488\u5bf9\u7684\u662fk8s 1.2+\u7684\uff0c\u4ece\u6587\u6863\u8bc4\u5206\u6765\u770b\uff0c\u53ea\u662f\u4e8c\u661f\u534a\uff0c\u7531\u6b64\u63a8\u65ad\uff0c\u5b8c\u5168\u6309\u7167\u6587\u6863\u4e2d\u7684\u6b65\u9aa4\u5b89\u88c5\uff0c\u6210\u529f\u4e0e\u5426\u8981\u770b\u8fd0\u6c14^_^\u3002\u6ce8\u610f\u8be5\u6587\u6863\u4e2d\u63d0\u5230\uff1a\u6587\u6863\u9488\u5bf9ubuntu 14.04\u662f\u6d4b\u8bd5ok\u7684\uff0c\u4f46\u7531\u4e8eubuntu15.xx\u4f7f\u7528systemd\u66ff\u4ee3upstart\u4e86\uff0c\u56e0\u6b64\u65e0\u6cd5\u4fdd\u8bc1\u5728ubuntu 15.xx\u4e0a\u53ef\u4ee5\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<p>\u5173\u4e8ek8s\u7684\u5b89\u88c5\u8fc7\u7a0b\uff0c\u7f51\u4e0a\u4e5f\u6709\u5f88\u591a\u8d44\u6599\uff0c\u591a\u6570\u8d44\u6599\u4e00\u4e0a\u6765\u5c31\u662f\u4e0b\u8f7dxxx\uff0c\u914d\u7f6eyyy\uff0cinstall zzz\uff0c\u7f3a\u5c11\u4e00\u4e2ak8s\u5b89\u88c5\u7684\u603b\u4f53\u89c6\u56fe\u3002\u4e0e\u5185\u7f6e\u7f16\u6392\u5f15\u64ceswarmkit\u7684\u5355\u4e00docker engine\u7684\u5b89\u88c5\u4e0d\u540c\uff0ck8s\u662f\u7531\u4e00\u7cfb\u5217\u6838\u5fc3\u7ec4\u4ef6\u914d\u5408\u534f\u4f5c\u5171\u540c\u5b8c\u6210\u5bb9\u5668\u96c6\u7fa4\u8c03\u5ea6\u548c\u670d\u52a1\u7f16\u6392\u529f\u80fd\u7684\uff0c\u5b89\u88c5k8s\u5b9e\u9645\u4e0a\u5c31\u662f\u5c06\u4e0d\u540c\u7ec4\u4ef6\u5b89\u88c5\u5230\u627f\u62c5\u4e0d\u540c\u89d2\u8272\u7684\u8282\u70b9\u4e0a\u53bb\u3002<\/p>\n<p>k8s\u7684\u8282\u70b9\u53ea\u6709\u4e24\u79cd\u89d2\u8272\uff1amaster\u548cminion\uff0c\u5bf9\u6bd4Docker swarm\u96c6\u7fa4\uff0cmaster\u76f8\u5f53\u4e8edocker swarm\u96c6\u7fa4\u4e2d\u7684manager\uff0c\u800cminion\u5219\u76f8\u5f53\u4e8edocker swarm\u96c6\u7fa4\u4e2d\u7684worker\u3002<\/p>\n<p>\u5728master\u8282\u70b9\u4e0a\u8fd0\u884c\u7684k8s\u6838\u5fc3\u7ec4\u4ef6\u5305\u62ec\uff1a<\/p>\n<pre><code># ls \/opt\/bin|grep kube\nkube-apiserver\nkube-controller-manager\nkubelet\nkube-proxy\nkube-scheduler\n<\/code><\/pre>\n<p>\u5728minion\u8282\u70b9\u4e0a\uff0ck8s\u6838\u5fc3\u7ec4\u4ef6\u8f83\u5c11\uff0c\u5305\u62ec\uff1a<\/p>\n<pre><code># ls \/opt\/bin|grep kube\nkubelet\nkube-proxy\n<\/code><\/pre>\n<p>k8s\u7684\u5b89\u88c5\u6a21\u578b\u53ef\u4ee5\u6982\u8ff0\u4e3a\uff1a\u5728\u5b89\u88c5\u673a\u4e0a\u5c06k8s\u7684\u5404\u4e2a\u7ec4\u4ef6\u5206\u522b\u90e8\u7f72\u5230\u4e0d\u540c\u89d2\u8272\u7684\u8282\u70b9\u4e0a\u53bb(\u901a\u8fc7ssh\u8fdc\u7a0b\u767b\u5f55\u5230\u5404\u8282\u70b9)\uff0c\u5e76\u542f\u52a8\u8d77\u6765\u3002\u7528\u4e0b\u9762\u8fd9\u4e2a\u7b80\u6613\u56fe\u8868\u8fbe\u8d77\u6765\u53ef\u80fd\u66f4\u52a0\u5f62\u8c61\uff1a<\/p>\n<pre><code>\u5b89\u88c5\u673a(\u653e\u7f6ek8s\u7684\u5b89\u88c5\u7a0b\u5e8f\u548c\u5b89\u88c5\u811a\u672c\uff09 ----- install k8s core components to(via ssh) ----&gt;  master and minion nodes\n<\/code><\/pre>\n<p>\u5728\u5b89\u88c5\u4e4b\u524d\uff0c\u8fd9\u91cc\u518d\u660e\u786e\u4e00\u4e0b\u6211\u6240\u7528\u7684\u73af\u5883\u4fe1\u606f\uff1a<\/p>\n<p>\u963f\u91cc\u4e91ECS: Ubuntu 14.04.4 LTS (GNU\/Linux 3.19.0-70-generic x86_64)<\/p>\n<p>root@iZ25cn4xxnvZ:~# docker version<br \/>\nClient:<br \/>\nVersion: 1.12.2<br \/>\nAPI version: 1.24<br \/>\nGo version: go1.6.3<br \/>\nGit commit: bb80604<br \/>\nBuilt: Tue Oct 11 17:00:50 2016<br \/>\nOS\/Arch: linux\/amd64<\/p>\n<p>Server:<br \/>\nVersion: 1.12.2<br \/>\nAPI version: 1.24<br \/>\nGo version: go1.6.3<br \/>\nGit commit: bb80604<br \/>\nBuilt: Tue Oct 11 17:00:50 2016<br \/>\nOS\/Arch: linux\/amd64<\/p>\n<h4>\u4e8c\u3001\u5148\u51b3\u6761\u4ef6<\/h4>\n<p>\u6839\u636e\u6d59\u5927\u56e2\u961f\u7684\u90a3\u7bc7\u5728Ubuntu\u4e0a\u5b89\u88c5k8s\u7684<a href=\"http:\/\/kubernetes.io\/docs\/getting-started-guides\/ubuntu\">\u6587\u7ae0<\/a>\uff0c\u5728\u771f\u6b63\u5b89\u88c5k8s\u7ec4\u4ef6\u4e4b\u524d\uff0c\u9700\u8981\u5148\u6ee1\u8db3\u4e00\u4e9b\u5148\u51b3\u6761\u4ef6\uff1a<\/p>\n<h5>1\u3001\u5b89\u88c5Docker<\/h5>\n<p>\u5173\u4e8e<a href=\"http:\/\/tonybai.com\/tag\/docker\">Docker<\/a>\u7684\u6587\u6863\uff0c\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u5199\u7684\u8fd8\u662f\u4e0d\u9519\u7684\u3002Docker\u5230\u76ee\u524d\u4e3a\u6b62\u5df2\u7ecf\u53d1\u5c55\u4e86\u8bb8\u591a\u5e74\u4e86\uff0c\u5176\u5728Ubuntu\u4e0a\u7684\u5b89\u88c5\u5df2\u7ecf\u9010\u6e10\u6210\u719f\u4e86\u3002\u5728\u5176<a href=\"https:\/\/docs.docker.com\/engine\/installation\/linux\/ubuntulinux\/\">\u5b98\u65b9\u6587\u6863<\/a>\u4e2d\u6709\u9488\u5bf9ubuntu 12.04\u300114.04\u548c16.04\u7684\u8be6\u7ec6\u5b89\u88c5\u8bf4\u660e\u3002\u5982\u679c\u4f60\u7684Ubuntu\u670d\u52a1\u5668\u4e0adocker\u7248\u672c\u8f83\u4f4e\uff0c\u8fd8\u53ef\u4ee5\u7528\u56fd\u5185Daocloud\u63d0\u4f9b\u7684<a href=\"http:\/\/get.daocloud.io\/#install-docker\">\u4e00\u952e\u5b89\u88c5\u670d\u52a1<\/a>\u6765\u5b89\u88c5\u6700\u65b0\u7248\u7684Docker\u3002<\/p>\n<h5>2\u3001\u5b89\u88c5bridge-utils<\/h5>\n<p>\u5b89\u88c5\u7f51\u6865\u7ba1\u7406\u5de5\u5177\uff1a<\/p>\n<pre><code>[sudo] apt-get install bridge-utils\n<\/code><\/pre>\n<p>\u5b89\u88c5\u540e\uff0c\u53ef\u4ee5\u6d4b\u8bd5\u4e00\u4e0b\u5b89\u88c5\u662f\u5426ok\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~# brctl show\nbridge name    bridge id        STP enabled    interfaces\ndocker0        8000.0242988b938c    no        veth901efcb\ndocker_gwbridge        8000.0242bffb02d5    no        veth21546ed\n                            veth984b294\n<\/code><\/pre>\n<h5>3\u3001\u786e\u4fddmaster node\u53ef\u4ee5\u8fde\u63a5\u4e92\u8054\u7f51\u5e76\u4e0b\u8f7d\u5fc5\u8981\u7684\u6587\u4ef6<\/h5>\n<p>\u8fd9\u91cc\u8981\u63d0\u5230\u7684\u662f\u4e3amaster node\u914d\u7f6e\u4e0a\u201d\u52a0\u901f\u5668\u201d\u3002\u540c\u65f6\u5982\u679cmaster node\u8fd8\u627f\u62c5\u903b\u8f91\u4e0a\u7684minion node\u89d2\u8272\uff0c\u8fd8\u9700\u8981\u4e3a\u8282\u70b9\u4e0aDocker\u914d\u7f6e\u4e0a\u52a0\u901f\u5668\uff08\u5982\u679c\u52a0\u901f\u5668\u662f\u901a\u8fc7\u4ee3\u7406\u914d\u7f6e\u7684\uff09\uff0cminion node\u4e0a\u4ea6\u662f\u5982\u6b64\uff0c\u6bd4\u5982\uff1a<\/p>\n<pre><code>\/etc\/default\/docker\n\nexport http_proxy=http:\/\/duotai:xxxxx@sheraton.h.xduotai.com:24448\nexport https_proxy=$http_proxy\n\n<\/code><\/pre>\n<h5>4\u3001\u5728\u5b89\u88c5\u673a\u4e0a\u914d\u7f6e\u81ea\u52a8<a href=\"http:\/\/tonybai.com\/2009\/07\/17\/physical-examination-and-ssh-and-safari4\/\">\u514d\u5bc6ssh\u767b\u5f55<\/a>\u5404\u4e2amaster node \u548cminion node<\/h5>\n<p>\u6211\u5728\u963f\u91cc\u4e91\u4e0a\u5f00\u4e86\u4e24\u4e2aECS\uff08\u6682\u6210\u4e3anode1 \u2013 10.47.136.60\u548cnode2 \u2013 10.46.181.146\uff09\uff0c\u6211\u7684k8s\u96c6\u7fa4\u5c31\u7531\u8fd9\u4e24\u4e2a\u7269\u7406node\u627f\u8f7d\uff0c\u4f46\u5728\u903b\u8f91\u4e0anode1\u548cnode2\u627f\u62c5\u7740\u591a\u79cd\u89d2\u8272\uff0c\u903b\u8f91\u4e0a\u8fd9\u662f\u4e00\u4e2a\u7531\u4e00\u4e2amaster node\u548c\u4e24\u4e2aminion node\u7ec4\u6210\u7684k8s\u96c6\u7fa4\uff1a<\/p>\n<pre><code>\u5b89\u88c5\u673a\uff1anode1\nmaster node\uff1anode1\nminion node: node1\u548cnode2\n\n<\/code><\/pre>\n<p>\u56e0\u6b64\u4e3a\u4e86\u6ee1\u8db3\u5b89\u88c5\u673a\u5230\u5404\u4e2ak8s node\u514d\u5bc6ssh\u767b\u5f55\u7684\u5148\u51b3\u6761\u4ef6\uff0c\u6211\u9700\u8981\u5b9e\u73b0\u4ece\u5b89\u88c5\u673a(node1)\u5230master node(node1)\u548cminion node(node1\u548cnode2)\u7684\u514d\u8d39ssh\u767b\u5f55\u8bbe\u7f6e\u3002<\/p>\n<p>\u5728\u5b89\u88c5\u673anode\u4e0a\u6267\u884c\uff1a<\/p>\n<pre><code># ssh-keygen -t rsa\nGenerating public\/private rsa key pair.\nEnter file in which to save the key (\/root\/.ssh\/id_rsa):\nEnter passphrase (empty for no passphrase):\nEnter same passphrase again:\nYour identification has been saved in \/root\/.ssh\/id_rsa.\nYour public key has been saved in \/root\/.ssh\/id_rsa.pub.\n... ...\n<\/code><\/pre>\n<p>\u5b89\u88c5\u673a\u514d\u5bc6\u767b\u5f55\u903b\u8f91\u610f\u4e49\u4e0a\u7684master node(\u5b9e\u9645\u4e0a\u5c31\u662f\u767b\u5f55\u81ea\u5df1\uff0c\u5373node1\uff09\uff1a<\/p>\n<pre><code>cat ~\/.ssh\/id_rsa.pub &gt;&gt; ~\/.ssh\/authorized_keys\n<\/code><\/pre>\n<p>\u5b89\u88c5\u673a\u514d\u8d39\u767b\u5f55minion node(node2)\uff1a<\/p>\n<pre><code>\u5c06\u516c\u94a5\u590d\u5236\u5230server\uff1a\n#scp ~\/.ssh\/id_rsa.pub root@10.46.181.146:\/root\/id_rsa.pub\nThe authenticity of host '10.46.181.146 (10.46.181.146)' can't be established.\nECDSA key fingerprint is b7:31:8d:33:f5:6e:ef:a4:a1:cc:72:5f:cf:68:c6:3d.\nAre you sure you want to continue connecting (yes\/no)? yes\nWarning: Permanently added '10.46.181.146' (ECDSA) to the list of known hosts.\nroot@10.46.181.146's password:\nid_rsa.pub\n<\/code><\/pre>\n<p>\u5728minion node\uff0c\u5373node2\u4e0a\uff0c\u5bfc\u5165\u5b89\u88c5\u673a\u7684\u516c\u94a5\u5e76\u4fee\u6539\u8bbf\u95ee\u6743\u9650\uff1a<\/p>\n<pre><code>cat ~\/id_rsa.pub &gt;&gt; ~\/.ssh\/authorized_keys\nroot@iZ25mjza4msZ:~# chmod 700 ~\/.ssh\nroot@iZ25mjza4msZ:~#     chmod 600 ~\/.ssh\/authorized_keys\n<\/code><\/pre>\n<p>\u914d\u7f6e\u5b8c\u6210\uff0c\u4f60\u53ef\u4ee5\u5728\u5b89\u88c5\u673a\u4e0a\u6d4b\u8bd5\u4e00\u4e0b\u5230\u81ea\u8eab(node1)\u548c\u5230node2\u7684\u514d\u5bc6\u767b\u5f55\uff0c\u4ee5\u514d\u5bc6\u767b\u5f55node2\u4e3a\u4f8b\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/.ssh# ssh 10.46.181.146\nWelcome to Ubuntu 14.04.4 LTS (GNU\/Linux 3.19.0-70-generic x86_64)\n\n * Documentation:  https:\/\/help.ubuntu.com\/\nNew release '16.04.1 LTS' available.\nRun 'do-release-upgrade' to upgrade to it.\n\nWelcome to aliyun Elastic Compute Service!\n\nLast login: Thu Oct 13 12:55:21 2016 from 218.25.32.210\n<\/code><\/pre>\n<h5>5\u3001\u4e0b\u8f7dpause-amd64\u955c\u50cf<\/h5>\n<p>k8s\u96c6\u7fa4\u542f\u52a8\u540e\uff0c\u542f\u52a8\u5bb9\u5668\u65f6\u4f1a\u53bb\u4e0b\u8f7dgoogle\u7684gcr.io\/google_containers\u4e0b\u7684\u4e00\u4e2apause-amd64\u955c\u50cf\uff0c\u4e3a\u4e86\u907f\u514d\u90a3\u65f6\u51fa\u9519\u65f6\u4e0d\u4fbf\u4e8e\u67e5\u627e\uff0c\u8fd9\u4e9b\u5148\u4e0b\u624b\u4e3a\u5f3a\uff0c\u5148\u901a\u8fc7\u201c\u52a0\u901f\u5668\u201d\u5c06\u8be5\u955c\u50cf\u4e0b\u8f7d\u5230\u5404\u4e2ak8s node\u4e0a\uff1a<\/p>\n<p>\u4fee\u6539\/etc\/default\/docker\uff0c\u6dfb\u52a0\u5e26\u6709\u52a0\u901f\u5668\u7684http_proxy\/https_proxy\uff0c\u5e76\u589e\u52a0\u2013insecure-registry gcr.io<\/p>\n<pre><code># If you need Docker to use an HTTP proxy, it can also be specified here.\nexport http_proxy=http:\/\/duotai:xxxx@sheraton.h.xduotai.com:24448\nexport https_proxy=http:\/\/duotai:xxxx@sheraton.h.xduotai.com:24448\n\n# This is also a handy place to tweak where Docker's temporary files go.\n#export TMPDIR=\"\/mnt\/bigdrive\/docker-tmp\"\nDOCKER_OPTS=\"$DOCKER_OPTS -H unix:\/\/\/var\/run\/docker.sock -H tcp:\/\/0.0.0.0:2375 --insecure-registry gcr.io\"\n<\/code><\/pre>\n<p>\u91cd\u542fdocker daemon\u670d\u52a1\u3002\u4e0b\u8f7dpause-amd64 image\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~# docker search gcr.io\/google_containers\/pause-amd64\nNAME                            DESCRIPTION   STARS     OFFICIAL   AUTOMATED\ngoogle_containers\/pause-amd64                 0\nroot@iZ25cn4xxnvZ:~# docker pull gcr.io\/google_containers\/pause-amd64\nUsing default tag: latest\nPulling repository gcr.io\/google_containers\/pause-amd64\nTag latest not found in repository gcr.io\/google_containers\/pause-amd64\n<\/code><\/pre>\n<p>latest\u6807\u7b7e\u5c45\u7136\u90fd\u6ca1\u6709\uff0c\u5c1d\u8bd5\u4e0b\u8f7d3.0\u6807\u7b7e\u7684pause-amd64\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~# docker pull gcr.io\/google_containers\/pause-amd64:3.0\n3.0: Pulling from google_containers\/pause-amd64\na3ed95caeb02: Pull complete\nf11233434377: Pull complete\nDigest: sha256:163ac025575b775d1c0f9bf0bdd0f086883171eb475b5068e7defa4ca9e76516\nStatus: Downloaded newer image for gcr.io\/google_containers\/pause-amd64:3.0\n<\/code><\/pre>\n<h4>\u4e09\u3001\u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55\uff0c\u8fdb\u884c\u5b89\u88c5\u524d\u7684\u5404\u79cd\u914d\u7f6e<\/h4>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u6240\u6709node\u4e0a\uff0c\u5305\u62ec\u5b89\u88c5\u673anode\u4e0a\u8fd8\u662f\u201c\u4e00\u65e0\u6240\u6709\u201d\u7684\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5f00\u59cb\u5728\u5b89\u88c5\u673anode\u4e0a\u505a\u6587\u7ae0\u3002<\/p>\n<p>\u4fd7\u8bdd\u8bf4\uff1a\u201c\u5de7\u5987\u4e0d\u4e3a\u65e0\u7c73\u708a\u201d\u3002\u5b89\u88c5\u673a\u60f3\u5728\u5404\u4e2anode\u4e0a\u5b89\u88c5k8s\u7ec4\u4ef6\uff0c\u5b89\u88c5\u673a\u672c\u8eab\u5c31\u8981\u6709\u201d\u7c73\u201d\u624d\u884c\uff0c\u8fd9\u4e2a\u7c73\u5c31\u662fk8s\u6e90\u7801\u5305\u6216release\u5305\u4e2d\u7684\u5b89\u88c5\u811a\u672c\u3002<\/p>\n<p>\u5728\u5b98\u65b9\u6587\u6863\u4e2d\uff0c\u8fd9\u4e2a\u83b7\u53d6\u201c\u7c73\u201d\u7684\u6b65\u9aa4\u4e3aclone k8s\u7684\u6e90\u7801\u5e93\u3002\u7531\u4e8e\u4e4b\u524d\u5c31\u4e0b\u8f7d\u4e86<a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/releases\/download\/v1.3.7\/kubernetes.tar.gz\">k8s 1.3.7\u7684release\u5305<\/a>\uff0c\u8fd9\u91cc\u6211\u5c31\u76f4\u63a5\u4f7f\u7528release\u5305\u4e2d\u7684\u201d\u7c73\u201d\u3002<\/p>\n<p>\u89e3\u538bkubernetes.tar.gz\u540e\uff0c\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u5c06\u770b\u5230kubernetes\u76ee\u5f55\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/1.3.7\/kubernetes# ls -F\ncluster\/  docs\/  examples\/  federation\/  LICENSES  platforms\/  README.md  server\/  third_party\/  Vagrantfile  version\n<\/code><\/pre>\n<p>\u8fd9\u4e2akubernetes\u76ee\u5f55\u5c31\u662f\u6211\u4eec\u5b89\u88c5k8s\u7684<strong>\u5de5\u4f5c\u76ee\u5f55<\/strong>\u3002\u7531\u4e8e\u6211\u4eec\u5728ubuntu\u4e0a\u5b89\u88c5k8s\uff0c\u56e0\u6b64\u6211\u4eec\u5b9e\u9645\u4e0a\u8981\u4f7f\u7528\u7684\u811a\u672c\u90fd\u5728\u5de5\u4f5c\u76ee\u5f55\u4e0b\u7684cluster\/ubuntu\u4e0b\u9762\uff0c\u540e\u7eed\u6709\u8be6\u7ec6\u8bf4\u660e\u3002<\/p>\n<p>\u5728\u5b89\u88c5\u673a\u4e0a\uff0c\u6211\u4eec\u6700\u7ec8\u662f\u8981\u6267\u884c\u8fd9\u6837\u4e00\u53e5\u811a\u672c\u7684\uff1a<\/p>\n<pre><code>KUBERNETES_PROVIDER=ubuntu .\/cluster\/kube-up.sh\n<\/code><\/pre>\n<p>\u5728provider=ubuntu\u7684\u60c5\u51b5\u4e0b\uff0c.\/cluster\/kube-up.sh\u6700\u7ec8\u4f1a\u8c03\u7528\u5230.\/cluster\/ubuntu\/util.sh\u4e2d\u7684kube-up shell\u51fd\u6570\uff0ckube-up\u51fd\u6570\u5219\u4f1a\u8c03\u7528.\/cluster\/ubuntu\/download-release.sh\u4e0b\u8f7dk8s\u5b89\u88c5\u6240\u4f7f\u7528\u5230\u7684\u6240\u6709\u5305\uff0c\u5305\u62eck8s\u7684\u5b89\u88c5\u5305(kubernetes.tar.gz)\u3001etcd\u548cflannel\u7b49\u3002\u7531\u4e8e\u4e4b\u524d\u6211\u4eec\u5df2\u7ecf\u4e0b\u8f7d\u5b8ck8s\u76841.3.7\u7248\u672crelease\u5305\u4e86\uff0c\u8fd9\u91cc\u6211\u4eec\u5c31\u9700\u8981\u5bf9down-release.sh\u505a\u4e00\u4e9b\u4fee\u6539\uff0c\u9632\u6b62\u91cd\u65b0\u4e0b\u8f7d\uff0c\u5bfc\u81f4\u5b89\u88c5\u65f6\u95f4\u8fc7\u957f\u3002<\/p>\n<pre><code>.\/cluster\/ubuntu\/download-release.sh\n\n    # KUBE_VERSION=$(get_latest_version_number | sed 's\/^v\/\/')\n    #curl -L https:\/\/github.com\/kubernetes\/kubernetes\/releases\/download\/v${KUBE_VERSION}\/kubernetes.tar.gz -o kubernetes.tar.gz\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f60\u8fd8\u9700\u8981\u628a\u5df2\u7ecf\u4e0b\u8f7d\u7684kubernetes.tar.gz\u6587\u4ef6copy\u4e00\u4efd\uff0c\u653e\u5230.\/cluster\/ubuntu\u4e0b\u9762\u3002<\/p>\n<p>\u5982\u679c\u4f60\u7684\u7f51\u7edc\u8bbf\u95ee\u56fd\u5916\u4e3b\u673a\u8db3\u591f\u5feb\uff0c\u4f60\u8fd8\u6709\u8db3\u591f\u8010\u5fc3\uff0c\u90a3\u4e48\u4f60\u5927\u53ef\u5ffd\u7565\u4e0a\u9762\u811a\u672c\u4fee\u6539\u7684\u6b65\u9aa4\u3002<\/p>\n<p>\u5728\u771f\u6b63\u6267\u884c.\/cluster\/kube-up.sh\u4e4b\u524d\uff0c\u5b89\u88c5\u673a\u8fd8\u9700\u8981\u77e5\u9053\uff1a<\/p>\n<p>1\u3001k8s\u7269\u7406\u96c6\u7fa4\u90fd\u6709\u54ea\u4e9bnode\u7ec4\u6210\uff0cnode\u7684\u89d2\u8272\u90fd\u662f\u4ec0\u4e48\uff1f<br \/>\n2\u3001k8s\u7684\u5404\u4e2a\u4f9d\u8d56\u7a0b\u5e8f\uff0c\u6bd4\u5982etcd\u7684\u7248\u672c\u662f\u4ec0\u4e48\uff1f<\/p>\n<p>\u6211\u4eec\u9700\u8981\u901a\u8fc7\u914d\u7f6e.\/cluster\/ubuntu\/config-default.sh\u8ba9.\/cluster\/kube-up.sh\u83b7\u53d6\u8fd9\u4e9b\u4fe1\u606f\u3002<\/p>\n<pre><code>.\/cluster\/ubuntu\/config-default.sh\n\n# node\u4fe1\u606f\uff0c\u672c\u96c6\u7fa4\u7531\u4e24\u4e2a\u7269\u7406node\u7ec4\u6210\uff0c\u5176\u4e2d\u7b2c\u4e00\u4e2anode\u65e2\u662fmaster\uff0c\u4e5f\u662fminion\nexport nodes=${nodes:-\"root@10.47.136.60  root@10.46.181.146\"}\nroles=${roles:-\"ai i\"}\n\n# minion node\u4e2a\u6570\nexport NUM_NODES=${NUM_NODES:-2}\n\n# \u4e3a\u5b89\u88c5\u811a\u672c\u914d\u7f6e\u7f51\u7edc\u4ee3\u7406\uff0c\u8fd9\u91cc\u4e3b\u8981\u662f\u4e3a\u4e86\u4f7f\u7528\u52a0\u901f\u5668\uff0c\u65b9\u4fbf\u6216\u52a0\u901f\u4e0b\u8f7d\u4e00\u4e9b\u5305\nPROXY_SETTING=${PROXY_SETTING:-\"http_proxy=http:\/\/duotai:xxxx@sheraton.h.xduotai.com:24448 https_proxy=http:\/\/duotai:xxxx@sheraton.h.xduotai.com:24448\"}\n<\/code><\/pre>\n<p>\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u8bbe\u7f6ek8s\u8981\u4e0b\u8f7d\u7684\u4f9d\u8d56\u7a0b\u5e8f\u7684\u7248\u672c\uff1a<\/p>\n<pre><code>export KUBE_VERSION=1.3.7\nexport FLANNEL_VERSION=0.5.5\nexport ETCD_VERSION=3.0.12\n<\/code><\/pre>\n<p>\u5982\u679c\u4e0d\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c.\/cluster\/ubuntu\/download-release.sh\u4e2d\u9ed8\u8ba4\u7684\u7248\u672c\u53f7\u5c06\u662f\uff1a<\/p>\n<pre><code>k8s\uff1a \u6700\u65b0\u7248\u672c\netcd\uff1a2.3.1\nflannel : 0.5.5\n<\/code><\/pre>\n<h4>\u56db\u3001\u6267\u884c\u5b89\u88c5<\/h4>\n<p>\u5728\u5b89\u88c5\u673a\u4e0a\uff0c\u8fdb\u5165.\/cluster\u76ee\u5f55\uff0c\u6267\u884c\u5982\u4e0b\u5b89\u88c5\u547d\u4ee4\uff1a<\/p>\n<pre><code>KUBERNETES_PROVIDER=ubuntu .\/kube-up.sh\n<\/code><\/pre>\n<p>\u6267\u884c\u8f93\u51fa\u5982\u4e0b\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/1.3.7\/kubernetes\/cluster# KUBERNETES_PROVIDER=ubuntu .\/kube-up.sh\n... Starting cluster using provider: ubuntu\n... calling verify-prereqs\nIdentity added: \/root\/.ssh\/id_rsa (\/root\/.ssh\/id_rsa)\n... calling kube-up\n~\/k8stest\/1.3.7\/kubernetes\/cluster\/ubuntu ~\/k8stest\/1.3.7\/kubernetes\/cluster\n\nPrepare flannel 0.5.5 release ...\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100   608    0   608    0     0    410      0 --:--:--  0:00:01 --:--:--   409\n100 3408k  100 3408k    0     0   284k      0  0:00:11  0:00:11 --:--:--  389k\n\nPrepare etcd 3.0.12 release ...\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100   607    0   607    0     0    388      0 --:--:--  0:00:01 --:--:--   388\n  3  9.8M    3  322k    0     0  84238      0  0:02:02  0:00:03  0:01:59  173k\n100  9.8M  100  9.8M    0     0   327k      0  0:00:30  0:00:30 --:--:--  344k\n\nPrepare kubernetes 1.3.7 release ...\n\n~\/k8stest\/1.3.7\/kubernetes\/cluster\/ubuntu\/kubernetes\/server ~\/k8stest\/1.3.7\/kubernetes\/cluster\/ubuntu ~\/k8stest\/1.3.7\/kubernetes\/cluster\n~\/k8stest\/1.3.7\/kubernetes\/cluster\/ubuntu ~\/k8stest\/1.3.7\/kubernetes\/cluster\n\nDone! All your binaries locate in kubernetes\/cluster\/ubuntu\/binaries directory\n~\/k8stest\/1.3.7\/kubernetes\/cluster\n\nDeploying master and node on machine 10.47.136.60\nsaltbase\/salt\/generate-cert\/make-ca-cert.sh: No such file or directory\neasy-rsa.tar.gz                                                                                                                               100%   42KB  42.4KB\/s   00:00\nconfig-default.sh                                                                                                                             100% 5610     5.5KB\/s   00:00\nutil.sh                                                                                                                                       100%   29KB  28.6KB\/s   00:00\nkubelet.conf                                                                                                                                  100%  644     0.6KB\/s   00:00\nkube-proxy.conf                                                                                                                               100%  684     0.7KB\/s   00:00\nkubelet                                                                                                                                       100% 2158     2.1KB\/s   00:00\nkube-proxy                                                                                                                                    100% 2233     2.2KB\/s   00:00\netcd.conf                                                                                                                                     100%  709     0.7KB\/s   00:00\nkube-scheduler.conf                                                                                                                           100%  674     0.7KB\/s   00:00\nkube-apiserver.conf                                                                                                                           100%  674     0.7KB\/s   00:00\nkube-controller-manager.conf                                                                                                                  100%  744     0.7KB\/s   00:00\nkube-scheduler                                                                                                                                100% 2360     2.3KB\/s   00:00\nkube-controller-manager                                                                                                                       100% 2672     2.6KB\/s   00:00\nkube-apiserver                                                                                                                                100% 2358     2.3KB\/s   00:00\netcd                                                                                                                                          100% 2073     2.0KB\/s   00:00\nreconfDocker.sh                                                                                                                               100% 2074     2.0KB\/s   00:00\nkube-scheduler                                                                                                                                100%   56MB  56.2MB\/s   00:01\nkube-controller-manager                                                                                                                       100%   95MB  95.4MB\/s   00:01\nkube-apiserver                                                                                                                                100%  105MB 104.9MB\/s   00:00\netcdctl                                                                                                                                       100%   18MB  17.6MB\/s   00:00\nflanneld                                                                                                                                      100%   16MB  15.8MB\/s   00:01\netcd                                                              100% 2074     2.0KB\/s   00:00\nkube-scheduler                                                                                              100%   56MB  56.2MB\/s   0         100%   56MB  56.2MB\/s   00:01\nkube-controller-manager                                                                                     100%   95MB  95.4MB\/s             100%   95MB  95.4MB\/s   00:01\nkube-apiserver                                                                                             100%  105MB 104.9MB\/s              100%  105MB 104.9MB\/s   00:00\netcdctl                                                                                                    100%   18MB  17.6MB\/s us           100%   18MB  17.6MB\/s   00:00\nflanneld                 10                                                                                100%   16MB  15.8MB\/sge            100%   16MB  15.8MB\/s   00:01\n\n... ...\n\n<\/code><\/pre>\n<p>\u7ed3\u679c\u4e2d\u5e76\u6ca1\u6709\u51fa\u73b0\u4ee3\u8868\u7740\u5b89\u88c5\u6210\u529f\u7684\u5982\u4e0blog\u5b57\u6837\uff1a<\/p>\n<pre><code>Cluster validation succeeded\n<\/code><\/pre>\n<p>\u67e5\u770b\u4e0a\u9762\u5b89\u88c5\u65e5\u5fd7\u8f93\u51fa\uff0c\u53d1\u73b0\u5728\u541110.47.136.60 master\u8282\u70b9\u90e8\u7f72\u7ec4\u4ef6\u65f6\uff0c\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\u65e5\u5fd7\uff1a<\/p>\n<pre><code>saltbase\/salt\/generate-cert\/make-ca-cert.sh: No such file or directory\n\n<\/code><\/pre>\n<p>\u67e5\u770b\u4e00\u4e0b.\/cluster\u4e0b\u7684\u786e\u6ca1\u6709saltbase\u76ee\u5f55\uff0c\u8fd9\u4e2a\u95ee\u9898\u5728\u7f51\u4e0a\u627e\u5230\u4e86\u7b54\u6848\uff0c\u89e3\u51b3\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>k8s\u5b89\u88c5\u5305\u76ee\u5f55\u4e0b\uff0c\u5728.\/server\/kubernetes\u4e0b\u5df2\u7ecf\u6709salt\u5305\uff1akubernetes-salt.tar.gz\uff0c\u89e3\u538b\u540e\uff0c\u5c06saltbase\u6574\u4e2a\u76ee\u5f55cp\u5230.cluster\/\u4e0b\u5373\u53ef\u3002\n<\/code><\/pre>\n<p>\u518d\u6b21\u6267\u884c\uff1aKUBERNETES_PROVIDER=ubuntu .\/kube-up.sh\uff0c\u53ef\u4ee5\u770b\u5230\u5982\u4e0b\u6267\u884c\u8f93\u51fa\uff1a<\/p>\n<pre><code>... ...\n\nDeploying master and node on machine 10.47.136.60\nmake-ca-cert.sh                                                                                                                               100% 4028     3.9KB\/s   00:00\neasy-rsa.tar.gz                                                                                                                               100%   42KB  42.4KB\/s   00:00\nconfig-default.sh                                                                                                                             100% 5632     5.5KB\/s   00:00\nutil.sh                                                                                                                                       100%   29KB  28.6KB\/s   00:00\nkubelet.conf                                                                                                                                  100%  644     0.6KB\/s   00:00\nkube-proxy.conf                                                                                                                               100%  684     0.7KB\/s   00:00\nkubelet                                                                                                                                       100% 2158     2.1KB\/s   00:00\nkube-proxy                                                                                                                                    100% 2233     2.2KB\/s   00:00\netcd.conf                                                                                                                                     100%  709     0.7KB\/s   00:00\nkube-scheduler.conf                                                                                                                           100%  674     0.7KB\/s   00:00\nkube-apiserver.conf                                                                                                                           100%  674     0.7KB\/s   00:00\nkube-controller-manager.conf                                                                                                                  100%  744     0.7KB\/s   00:00\nkube-scheduler                                                                                                                                100% 2360     2.3KB\/s   00:00\nkube-controller-manager                                                                                                                       100% 2672     2.6KB\/s   00:00\nkube-apiserver                                                                                                                                100% 2358     2.3KB\/s   00:00\netcd                                                                                                                                          100% 2073     2.0KB\/s   00:00\nreconfDocker.sh                                                                                                                               100% 2074     2.0KB\/s   00:00\nkube-scheduler                                                                                                                                100%   56MB  56.2MB\/s   00:01\nkube-controller-manager                                                                                                                       100%   95MB  95.4MB\/s   00:00\nkube-apiserver                                                                                                                                100%  105MB 104.9MB\/s   00:01\netcdctl                                                                                                                                       100%   18MB  17.6MB\/s   00:00\nflanneld                                                                                                                                      100%   16MB  15.8MB\/s   00:00\netcd                                                                                                                                          100%   19MB  19.3MB\/s   00:00\nflanneld                                                                                                                                      100%   16MB  15.8MB\/s   00:00\nkubelet                                                                                                                                       100%  103MB 103.1MB\/s   00:01\nkube-proxy                                                                                                                                    100%   48MB  48.4MB\/s   00:00\nflanneld.conf                                                                                                                                 100%  577     0.6KB\/s   00:00\nflanneld                                                                                                                                      100% 2121     2.1KB\/s   00:00\nflanneld.conf                                                                                                                                 100%  568     0.6KB\/s   00:00\nflanneld                                                                                                                                      100% 2131     2.1KB\/s   00:00\netcd start\/running, process 7997\nError:  dial tcp 127.0.0.1:2379: getsockopt: connection refused\n{\"Network\":\"172.16.0.0\/16\", \"Backend\": {\"Type\": \"vxlan\"}}\n{\"Network\":\"172.16.0.0\/16\", \"Backend\": {\"Type\": \"vxlan\"}}\ndocker stop\/waiting\ndocker start\/running, process 8220\nConnection to 10.47.136.60 closed.\n\nDeploying node on machine 10.46.181.146\nconfig-default.sh                                                                                                                             100% 5632     5.5KB\/s   00:00\nutil.sh                                                                                                                                       100%   29KB  28.6KB\/s   00:00\nreconfDocker.sh                                                                                                                               100% 2074     2.0KB\/s   00:00\nkubelet.conf                                                                                                                                  100%  644     0.6KB\/s   00:00\nkube-proxy.conf                                                                                                                               100%  684     0.7KB\/s   00:00\nkubelet                                                                                                                                       100% 2158     2.1KB\/s   00:00\nkube-proxy                                                                                                                                    100% 2233     2.2KB\/s   00:00\nflanneld                                                                                                                                      100%   16MB  15.8MB\/s   00:00\nkubelet                                                                                                                                       100%  103MB 103.1MB\/s   00:01\nkube-proxy                                                                                                                                    100%   48MB  48.4MB\/s   00:00\nflanneld.conf                                                                                                                                 100%  577     0.6KB\/s   00:00\nflanneld                                                                                                                                      100% 2121     2.1KB\/s   00:00\nflanneld start\/running, process 2365\ndocker stop\/waiting\ndocker start\/running, process 2574\nConnection to 10.46.181.146 closed.\nValidating master\nValidating root@10.47.136.60\nValidating root@10.46.181.146\nUsing master 10.47.136.60\ncluster \"ubuntu\" set.\nuser \"ubuntu\" set.\ncontext \"ubuntu\" set.\nswitched to context \"ubuntu\".\nWrote config for ubuntu to \/root\/.kube\/config\n... calling validate-cluster\n\nError from server: an error on the server has prevented the request from succeeding\n(kubectl failed, will retry 2 times)\n\nError from server: an error on the server has prevented the request from succeeding\n(kubectl failed, will retry 1 times)\n\nError from server: an error on the server has prevented the request from succeeding\n('kubectl get nodes' failed, giving up)\n\n<\/code><\/pre>\n<p>\u5b89\u88c5\u5e76\u672a\u6210\u529f\uff0c\u81f3\u5c11calling validate-cluster\u540e\u7684validation\u8fc7\u7a0b\u5e76\u672a\u6210\u529f\u3002<\/p>\n<p>\u4f46\u662f\u548c\u7b2c\u4e00\u6b21\u7684\u5931\u8d25\u6709\u6240\u4e0d\u540c\u7684\u662f\uff0c\u5728master node\u548cminion node\u4e0a\uff0c\u6211\u4eec\u90fd\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u5b89\u88c5\u5e76\u542f\u52a8\u4e86\u7684k8s\u6838\u5fc3\u7ec4\u4ef6\uff1a<\/p>\n<p>master node\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/1.3.7\/kubernetes\/cluster# ps -ef|grep kube\nroot      8006     1  0 16:39 ?        00:00:00 \/opt\/bin\/kube-scheduler --logtostderr=true --master=127.0.0.1:8080\nroot      8008     1  0 16:39 ?        00:00:01 \/opt\/bin\/kube-apiserver --insecure-bind-address=0.0.0.0 --insecure-port=8080 --etcd-servers=http:\/\/127.0.0.1:4001 --logtostderr=true --service-cluster-ip-range=192.168.3.0\/24 --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,SecurityContextDeny,ResourceQuota --service-node-port-range=30000-32767 --advertise-address=10.47.136.60 --client-ca-file=\/srv\/kubernetes\/ca.crt --tls-cert-file=\/srv\/kubernetes\/server.cert --tls-private-key-file=\/srv\/kubernetes\/server.key\nroot      8009     1  0 16:39 ?        00:00:02 \/opt\/bin\/kube-controller-manager --master=127.0.0.1:8080 --root-ca-file=\/srv\/kubernetes\/ca.crt --service-account-private-key-file=\/srv\/kubernetes\/server.key --logtostderr=true\nroot      8021     1  0 16:39 ?        00:00:04 \/opt\/bin\/kubelet --hostname-override=10.47.136.60 --api-servers=http:\/\/10.47.136.60:8080 --logtostderr=true --cluster-dns=192.168.3.10 --cluster-domain=cluster.local --config=\nroot      8023     1  0 16:39 ?        00:00:00 \/opt\/bin\/kube-proxy --hostname-override=10.47.136.60 --master=http:\/\/10.47.136.60:8080 --logtostderr=true\n<\/code><\/pre>\n<p>minion node\uff1a<\/p>\n<pre><code>root@iZ25mjza4msZ:~# ps -ef|grep kube\nroot      2370     1  0 16:39 ?        00:00:04 \/opt\/bin\/kubelet --hostname-override=10.46.181.146 --api-servers=http:\/\/10.47.136.60:8080 --logtostderr=true --cluster-dns=192.168.3.10 --cluster-domain=cluster.local --config=\nroot      2371     1  0 16:39 ?        00:00:00 \/opt\/bin\/kube-proxy --hostname-override=10.46.181.146 --master=http:\/\/10.47.136.60:8080 --logtostderr=true\n\n<\/code><\/pre>\n<p>\u90a3\u4e3a\u4ec0\u4e48\u5b89\u88c5\u8282\u70b9\u4e0a\u7684\u5b89\u88c5\u811a\u672c\u5728\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u65f6\u4e00\u76f4\u963b\u585e\u3001\u6700\u7ec8\u8d85\u65f6\u5931\u8d25\u5462\uff1f\u6211\u5728\u5b89\u88c5\u8282\u70b9\uff0c\u540c\u65f6\u4e5f\u662fmaster node\u4e0a\u6267\u884c\u4e86\u4e00\u4e0bkubectl get node\u547d\u4ee4\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/1.3.7\/kubernetes\/cluster# kubectl get nodes\n\nError from server: an error on the server (\"&lt;!DOCTYPE html PUBLIC \\\"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\\\" \\\"http:\/\/www.w3.org\/TR\/html4\/strict.dtd\\\"&gt;\\n&lt;html&gt;&lt;head&gt;\\n&lt;meta type=\\\"copyright\\\" content=\\\"Copyright (C) 1996-2015 The Squid Software Foundation and contributors\\\"&gt;\\n&lt;meta http-equiv=\\\"Content-Type\\\" CONTENT=\\\"text\/html; charset=utf-8\\\"&gt;\\n&lt;title&gt;ERROR: The requested URL could not be retrieved&lt;\/title&gt;\\n&lt;style type=\\\"text\/css\\\"&gt;&lt;!-- \\n \/*\\n * Copyright (C) 1996-2015 The Squid Software Foundation and contributors\\n *\\n * Squid software is distributed under GPLv2+ license and includes\\n * contributions from numerous individuals and organizations.\\n * Please see the COPYING and CONTRIBUTORS files for details.\\n *\/\\n\\n\/*\\n Stylesheet for Squid Error pages\\n Adapted from design by Free CSS Templates\\n http:\/\/www.freecsstemplates.org\\n Released for free under a Creative Commons Attribution 2.5 License\\n*\/\\n\\n\/* Page basics *\/\\n* {\\n\\tfont-family: verdana, sans-serif;\\n}\\n\\nhtml body {\\n\\tmargin: 0;\\n\\tpadding: 0;\\n\\tbackground: #efefef;\\n\\tfont-size: 12px;\\n\\tcolor: #1e1e1e;\\n}\\n\\n\/* Page displayed title area *\/\\n#titles {\\n\\tmargin-left: 15px;\\n\\tpadding: 10px;\\n\\tpadding-left: 100px;\\n\\tbackground: url('\/squid-internal-static\/icons\/SN.png') no-repeat left;\\n}\\n\\n\/* initial title *\/\\n#titles h1 {\\n\\tcolor: #000000;\\n}\\n#titles h2 {\\n\\tcolor: #000000;\\n}\\n\\n\/* special event: FTP success page titles *\/\\n#titles ftpsuccess {\\n\\tbackground-color:#00ff00;\\n\\twidth:100%;\\n}\\n\\n\/* Page displayed body content area *\/\\n#content {\\n\\tpadding: 10px;\\n\\tbackground: #ffffff;\\n}\\n\\n\/* General text *\/\\np {\\n}\\n\\n\/* error brief description *\/\\n#error p {\\n}\\n\\n\/* some data which may have caused the problem *\/\\n#data {\\n}\\n\\n\/* the error message received from the system or other software *\/\\n#sysmsg {\\n}\\n\\npre {\\n    font-family:sans-serif;\\n}\\n\\n\/* special event: FTP \/ Gopher directory listing *\/\\n#dirmsg {\\n    font-family: courier;\\n    color: black;\\n    font-size: 10pt;\\n}\\n#dirlisting {\\n    margin-left: 2%;\\n    margin-right: 2%;\\n}\\n#dirlisting tr.entry td.icon,td.filename,td.size,td.date {\\n    border-bottom: groove;\\n}\\n#dirlisting td.size {\\n    width: 50px;\\n    text-align: right;\\n    padding-right: 5px;\\n}\\n\\n\/* horizontal lines *\/\\nhr {\\n\\tmargin: 0;\\n}\\n\\n\/* page displayed footer area *\/\\n#footer {\\n\\tfont-size: 9px;\\n\\tpadding-left: 10px;\\n}\\n\\n\\nbody\\n:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }\\n:lang(he) { direction: rtl; }\\n --&gt;&lt;\/style&gt;\\n&lt;\/head&gt;&lt;body id=ERR_CONNECT_FAIL&gt;\\n&lt;div id=\\\"titles\\\"&gt;\\n&lt;h1&gt;ERROR&lt;\/h1&gt;\\n&lt;h2&gt;The requested URL could not be retrieved&lt;\/h2&gt;\\n&lt;\/div&gt;\\n&lt;hr&gt;\\n\\n&lt;div id=\\\"content\\\"&gt;\\n&lt;p&gt;The following error was encountered while trying to retrieve the URL: &lt;a href=\\\"http:\/\/10.47.136.60:8080\/api\\\"&gt;http:\/\/10.47.136.60:8080\/api&lt;\/a&gt;&lt;\/p&gt;\\n\\n&lt;blockquote id=\\\"error\\\"&gt;\\n&lt;p&gt;&lt;b&gt;Connection to 10.47.136.60 failed.&lt;\/b&gt;&lt;\/p&gt;\\n&lt;\/blockquote&gt;\\n\\n&lt;p id=\\\"sysmsg\\\"&gt;The system returned: &lt;i&gt;(110) Connection timed out&lt;\/i&gt;&lt;\/p&gt;\\n\\n&lt;p&gt;The remote host or network may be down. Please try the request again.&lt;\/p&gt;\\n\\n&lt;p&gt;Your cache administrator is &lt;a href=\\\"mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_CONNECT_FAIL&amp;amp;body=CacheHost%3A%20192-241-236-182%0D%0AErrPage%3A%20ERR_CONNECT_FAIL%0D%0AErr%3A%20(110)%20Connection%20timed%20out%0D%0ATimeStamp%3A%20Thu,%2013%20Oct%202016%2008%3A49%3A35%20GMT%0D%0A%0D%0AClientIP%3A%20127.0.0.1%0D%0AServerIP%3A%2010.47.136.60%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2Fapi%20HTTP%2F1.1%0AUser-Agent%3A%20kubectl%2Fv1.4.0%20(linux%2Famd64)%20kubernetes%2F4b28af1%0D%0AAccept%3A%20application%2Fjson,%20*%2F*%0D%0AAccept-Encoding%3A%20gzip%0D%0AHost%3A%2010.47.136.60%3A8080%0D%0A%0D%0A%0D%0A\\\"&gt;webmaster&lt;\/a&gt;.&lt;\/p&gt;\\n\\n&lt;br&gt;\\n&lt;\/div&gt;\\n\\n&lt;hr&gt;\\n&lt;div id=\\\"footer\\\"&gt;\\n&lt;p&gt;Generated Thu, 13 Oct 2016 08:49:35 GMT by 192-241-236-182 (squid\/3.5.12)&lt;\/p&gt;\\n&lt;!-- ERR_CONNECT_FAIL --&gt;\\n&lt;\/div&gt;\\n&lt;\/body&gt;&lt;\/html&gt;\") has prevented the request from succeeding\n\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230kubectl\u5f97\u5230\u4e00\u5768\u4fe1\u606f\uff0c\u8fd9\u662f\u4e00\u4e2ahtml\u9875\u9762\u5185\u5bb9\u7684\u6570\u636e\uff0c\u4ed4\u7ec6\u5206\u6790body\u5185\u5bb9\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff1a<\/p>\n<pre><code>&lt;body id=ERR_CONNECT_FAIL&gt;\\n&lt;div id=\\\"titles\\\"&gt;\\n&lt;h1&gt;ERROR&lt;\/h1&gt;\\n&lt;h2&gt;The requested URL could not be retrieved&lt;\/h2&gt;\\n&lt;\/div&gt;\\n&lt;hr&gt;\\n\\n&lt;div id=\\\"content\\\"&gt;\\n&lt;p&gt;The following error was encountered while trying to retrieve the URL: &lt;a href=\\\"http:\/\/10.47.136.60:8080\/api\\\"&gt;http:\/\/10.47.136.60:8080\/api&lt;\/a&gt;&lt;\/p&gt;\\n\\n&lt;blockquote id=\\\"error\\\"&gt;\\n&lt;p&gt;&lt;b&gt;Connection to 10.47.136.60 failed.&lt;\/b&gt;&lt;\/p&gt;\\n&lt;\/blockquote&gt;\\n\\n&lt;p id=\\\"sysmsg\\\"&gt;The system returned: &lt;i&gt;(110) Connection timed out&lt;\/i&gt;&lt;\/p&gt;\\n\\n&lt;p&gt;The remote host or network may be down. Please try the request again.&lt;\/p&gt;\n<\/code><\/pre>\n<p>kubectl\u5728\u8bbf\u95eehttp:\/\/10.47.136.60:8080\/api\u8fd9\u4e2aurl\u65f6\u51fa\u73b0\u4e86timed out\u9519\u8bef\u3002\u5728master node\u4e0a\u76f4\u63a5\u6267\u884ccurl http:\/\/10.47.136.60:8080\/api\u4e5f\u662f\u8fd9\u4e2a\u9519\u8bef\u3002\u731c\u60f3\u662f\u5426\u662f\u6211.bashrc\u4e2d\u7684http_proxy\u5728\u4f5c\u795f\u3002\u4e8e\u662f\u5728.bashrc\u4e2d\u589e\u52a0no_proxy:<\/p>\n<pre><code>export no_proxy='10.47.136.60,10.46.181.146,localhost,127.0.0.1'\n<\/code><\/pre>\n<p>\u751f\u6548\u540e\uff0c\u518d\u5728master node\u4e0a\u6267\u884ccurl\uff1a<\/p>\n<pre><code># curl http:\/\/10.47.136.60:8080\/api\n{\n  \"kind\": \"APIVersions\",\n  \"versions\": [\n    \"v1\"\n  ],\n  \"serverAddressByClientCIDRs\": [\n    {\n      \"clientCIDR\": \"0.0.0.0\/0\",\n      \"serverAddress\": \"10.47.136.60:6443\"\n    }\n  ]\n}\n\n<\/code><\/pre>\n<p>\u770b\u6765\u95ee\u9898\u539f\u56e0\u5c31\u662f\u5b89\u88c5\u7a0b\u5e8f\u7684PROXY_SETTING\u4e2d\u6ca1\u6709\u52a0\u5165no_proxy\u7684\u8bbe\u7f6e\u7684\u7f18\u6545\uff0c\u4e8e\u662f\u4fee\u6539config-default.sh\u4e2d\u7684\u4ee3\u7406\u8bbe\u7f6e\uff1a<\/p>\n<pre><code>PROXY_SETTING=${PROXY_SETTING:-\"http_proxy=http:\/\/duotai:xxxx@sheraton.h.xduotai.com:24448 https_proxy=http:\/\/duotai:xxxx@sheraton.h.xduotai.com:24448 no_proxy=10.47.136.60,10.46.181.146,localhost,127.0.0.1\"}\n<\/code><\/pre>\n<p>\u7136\u540e\u91cd\u65b0deploy\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/1.3.7\/kubernetes\/cluster# KUBERNETES_PROVIDER=ubuntu .\/kube-up.sh\n... Starting cluster using provider: ubuntu\n... calling verify-prereqs\nIdentity added: \/root\/.ssh\/id_rsa (\/root\/.ssh\/id_rsa)\n... calling kube-up\n~\/k8stest\/1.3.7\/kubernetes\/cluster\/ubuntu ~\/k8stest\/1.3.7\/kubernetes\/cluster\nPrepare flannel 0.5.5 release ...\nPrepare etcd 3.0.12 release ...\nPrepare kubernetes 1.3.7 release ...\nDone! All your binaries locate in kubernetes\/cluster\/ubuntu\/binaries directory\n~\/k8stest\/1.3.7\/kubernetes\/cluster\n\nDeploying master and node on machine 10.47.136.60\nmake-ca-cert.sh                                                                                                                               100% 4028     3.9KB\/s   00:00\neasy-rsa.tar.gz                                                                                                                               100%   42KB  42.4KB\/s   00:00\nconfig-default.sh                                                                                                                             100% 5678     5.5KB\/s   00:00\n... ...\ncp: cannot create regular file \u2018\/opt\/bin\/etcd\u2019: Text file busy\ncp: cannot create regular file \u2018\/opt\/bin\/flanneld\u2019: Text file busy\ncp: cannot create regular file \u2018\/opt\/bin\/kube-apiserver\u2019: Text file busy\ncp: cannot create regular file \u2018\/opt\/bin\/kube-controller-manager\u2019: Text file busy\ncp: cannot create regular file \u2018\/opt\/bin\/kube-scheduler\u2019: Text file busy\nConnection to 10.47.136.60 closed.\nDeploying master and node on machine 10.47.136.60 failed\n<\/code><\/pre>\n<p>\u91cd\u65b0\u90e8\u7f72\u65f6\uff0c\u7531\u4e8e\u4e4b\u524dk8s cluster\u5728\u5404\u4e2anode\u7684\u7ec4\u4ef6\u5df2\u7ecf\u542f\u52a8\uff0c\u56e0\u6b64failed\u3002\u6211\u4eec\u9700\u8981\u901a\u8fc7<\/p>\n<pre><code>KUBERNETES_PROVIDER=ubuntu kube-down.sh\n<\/code><\/pre>\n<p>\u5c06k8s\u96c6\u7fa4\u505c\u6b62\u540e\u518d\u5c1d\u8bd5up\uff0c\u6216\u8005\u5982\u679c\u4e0d\u7528\u8fd9\u4e2akube-down.sh\u811a\u672c\uff0c\u4e5f\u53ef\u4ee5\u5728\u5404\u4e2a\u8282\u70b9\u4e0a\u624b\u52a8shutdown\u5404\u4e2ak8s\u7ec4\u4ef6(master\u4e0a\u6709\u4e94\u4e2a\u6838\u5fc3\u7ec4\u4ef6\uff0cminion node\u4e0a\u6709\u4e24\u4e2a\u6838\u5fc3\u7ec4\u4ef6\uff0c\u53e6\u5916\u522b\u5fd8\u4e86\u505c\u6b62etcd\u548cflanneld\u670d\u52a1)\uff0c\u4ee5kube-controller-manager\u4e3a\u4f8b\uff1a<\/p>\n<pre><code>service kube-controller-manager stop\n<\/code><\/pre>\n<p>\u5373\u53ef\u3002<\/p>\n<p>\u518d\u6b21\u6267\u884ckube-up.sh\uff1a<\/p>\n<pre><code>... ...\n.. calling validate-cluster\nWaiting for 2 ready nodes. 1 ready nodes, 2 registered. Retrying.\nFound 2 node(s).\nNAME            STATUS    AGE\n10.46.181.146   Ready     4h\n10.47.136.60    Ready     4h\nValidate output:\nNAME                 STATUS    MESSAGE              ERROR\nscheduler            Healthy   ok\ncontroller-manager   Healthy   ok\netcd-0               Healthy   {\"health\": \"true\"}\nCluster validation succeeded\nDone, listing cluster services:\n\nKubernetes master is running at http:\/\/10.47.136.60:8080\n\nTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.\n\n<\/code><\/pre>\n<p>\u901a\u8fc7\u5b57\u6837\uff1a\u201dCluster validation succeeded\u201d\u53ef\u4ee5\u8bc1\u660e\u6211\u4eec\u6210\u529f\u5b89\u88c5\u4e86k8s\u96c6\u7fa4\u3002<\/p>\n<p>\u6267\u884ckubectl get node\u53ef\u4ee5\u770b\u5230\u5f53\u524d\u96c6\u7fa4\u7684\u8282\u70b9\u7ec4\u6210\u60c5\u51b5\uff1a<\/p>\n<pre><code># kubectl get node\nNAME            STATUS    AGE\n10.46.181.146   Ready     4h\n10.47.136.60    Ready     4h\n<\/code><\/pre>\n<p>\u901a\u8fc7\u6267\u884ckubectl cluster-info dump \u53ef\u4ee5\u770b\u5230k8s\u96c6\u7fa4\u66f4\u4e3a\u8be6\u5c3d\u7684\u4fe1\u606f\u3002<\/p>\n<h4>\u4e94\u3001\u6d4b\u8bd5k8s\u7684service\u7279\u6027<\/h4>\n<p>\u4e4b\u6240\u4ee5\u91c7\u7528k8s\uff0c\u521d\u8877\u5c31\u662f\u56e0\u4e3aDocker 1.12\u5728\u963f\u91cc\u4e91\u642d\u5efa\u7684swarm\u96c6\u7fa4\u7684VIP\u548cRouting mesh\u673a\u5236\u4e0d\u597d\u7528\u3002\u56e0\u6b64\uff0c\u5728k8s\u96c6\u7fa4\u90e8\u7f72\u6210\u529f\u540e\uff0c\u6211\u4eec\u9700\u8981\u6d4b\u8bd5\u4e00\u4e0b\u8fd9\u4e24\u79cd\u673a\u5236\u5728k8s\u4e0a\u662f\u5426\u80fd\u591f\u83b7\u5f97\u652f\u6301\u3002<\/p>\n<p>k8s\u4e2d\u4e00\u4e9b\u5173\u4e8e\u96c6\u7fa4\u7684\u62bd\u8c61\u6982\u5ff5\uff0c\u6bd4\u5982node\u3001deployment\u3001pod\u3001service\u7b49\uff0c\u8fd9\u91cc\u5c31\u4e0d\u8d58\u8ff0\u4e86\uff0c\u9700\u8981\u7684\u8bdd\u53ef\u4ee5\u53c2\u8003<a href=\"http:\/\/kubernetes.io\/docs\/user-guide\/\">\u8fd9\u91cc<\/a>\u7684Concept guide\u3002<\/p>\n<h5>1\u3001\u96c6\u7fa4\u5185\u8d1f\u8f7d\u5747\u8861<\/h5>\n<p>\u5728k8s\u96c6\u7fa4\u4e2d\uff0c\u6709\u4e00\u4e2a\u7b49\u540c\u4e8edocker swarm vip\u7684\u6982\u5ff5\uff0c\u6210\u4e3acluster ip\uff0ck8s\u56de\u4e3a\u6bcf\u4e2aservice\u5206\u914d\u4e00\u4e2acluster ip\uff0c\u8fd9\u4e2acluster ip\u5728service\u751f\u547d\u5468\u671f\u4e2d\u4e0d\u4f1a\u6539\u53d8\uff0c\u5e76\u4e14\u8bbf\u95eecluster ip\u7684\u8bf7\u6c42\u4f1a\u88ab\u81ea\u52a8\u8d1f\u8f7d\u5747\u8861\u5230service\u91cc\u7684\u540e\u7aefcontainer\u4e2d\u3002<\/p>\n<p>\u6211\u4eec\u6765\u542f\u52a8\u4e00\u4e2areplicas= 2\u7684nginx service\uff0c\u6211\u4eec\u9700\u8981\u5148\u4ece\u4e00\u4e2a\u63cf\u8ff0\u6587\u4ef6\u6765\u90e8\u7f72\u4e00\u4e2adeployment\uff1a<\/p>\n<pre><code>\/\/run-my-nginx.yaml\n\napiVersion: extensions\/v1beta1\nkind: Deployment\nmetadata:\n  name: my-nginx\nspec:\n  replicas: 2\n  template:\n    metadata:\n      labels:\n        run: my-nginx\n    spec:\n      containers:\n      - name: my-nginx\n        image: nginx:1.10.1\n        ports:\n        - containerPort: 80\n<\/code><\/pre>\n<p>\u542f\u52a8deployment:<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl create -f .\/run-my-nginx.yaml\ndeployment \"my-nginx\" created\n\nroot@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl get deployment\nNAME       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nmy-nginx   2         2         2            2           9s\n\nroot@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl get pods -l run=my-nginx -o wide\nNAME                        READY     STATUS    RESTARTS   AGE       IP            NODE\nmy-nginx-2395715568-2t6xe   1\/1       Running   0          50s       172.16.57.3   10.46.181.146\nmy-nginx-2395715568-gpljv   1\/1       Running   0          50s       172.16.99.2   10.47.136.60\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230my-nginx deployment\u5df2\u7ecf\u6210\u529f\u542f\u52a8\uff0c\u5e76\u4e14\u88ab\u8c03\u5ea6\u5728\u4e24\u4e2aminion node\u4e0a\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06deployment\u8f6c\u5316\u4e3aservice:<\/p>\n<pre><code># kubectl expose deployment\/my-nginx\nservice \"my-nginx\" exposed\n\nroot@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl get svc my-nginx\nNAME       CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE\nmy-nginx   192.168.3.239   &lt;none&gt;        80\/TCP    15s\n\n# kubectl describe svc my-nginx\nName:            my-nginx\nNamespace:        default\nLabels:            run=my-nginx\nSelector:        run=my-nginx\nType:            ClusterIP\nIP:            192.168.3.239\nPort:            &lt;unset&gt;    80\/TCP\nEndpoints:        172.16.57.3:80,172.16.99.2:80\nSession Affinity:    None\n\n<\/code><\/pre>\n<p>\u6211\u4eec\u770b\u5230\u901a\u8fc7expose\u547d\u4ee4\uff0c\u53ef\u4ee5\u5c06deployment\u8f6c\u5316\u4e3aservice\uff0c\u8f6c\u5316\u540e\uff0cmy-nginx service\u88ab\u5206\u914d\u4e86\u4e00\u4e2acluster-ip\uff1a192.168.3.239\u3002<\/p>\n<p>\u6211\u4eec\u542f\u52a8\u4e00\u4e2aclient container\u7528\u4e8e\u6d4b\u8bd5\u5185\u90e8\u8d1f\u8f7d\u5747\u8861\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl run myclient --image=registry.cn-hangzhou.aliyuncs.com\/mioss\/test --replicas=1 --command -- tail -f \/var\/log\/bootstrap.log\ndeployment \"myclient\" created\n\nroot@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl get pods\nNAME                        READY     STATUS    RESTARTS   AGE\nmy-nginx-2395715568-2t6xe   1\/1       Running   0          24m\nmy-nginx-2395715568-gpljv   1\/1       Running   0          24m\nmyclient-1460251692-g7rnl   1\/1       Running   0          21s\n\n<\/code><\/pre>\n<p>\u901a\u8fc7docker exec -it containerid \/bin\/bash\u8fdb\u5165myclient\u5bb9\u5668\u5185\uff0c\u901a\u8fc7curl\u5411\u4e0a\u9762\u7684cluster-ip\u53d1\u8d77http\u8bf7\u6c42\uff1a<\/p>\n<pre><code>root@myclient-1460251692-g7rnl:\/# curl -v 192.168.3.239:80\n<\/code><\/pre>\n<p>\u540c\u65f6\u5728\u4e24\u4e2aminion\u8282\u70b9\u4e0a\uff0c\u901a\u8fc7docker logs -f\u67e5\u770bmy-nginx service\u4e0b\u9762\u7684\u4e24\u4e2anginx container\u5b9e\u4f8b\u65e5\u5fd7\uff0c\u53ef\u4ee5\u770b\u5230\u4e24\u4e2acontainer\u8f6e\u8be2\u6536\u5230http request:<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/demo# docker logs -f  ccc2f9bb814a\n172.16.57.0 - - [17\/Oct\/2016:06:35:57 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:06:36:13 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:06:37:06 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:06:37:45 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:06:37:46 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:06:37:50 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n\nroot@iZ25mjza4msZ:~# docker logs -f 0e533ec2dc71\n172.16.57.4 - - [17\/Oct\/2016:06:33:14 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.4 - - [17\/Oct\/2016:06:33:18 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.4 - - [17\/Oct\/2016:06:34:06 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.4 - - [17\/Oct\/2016:06:34:09 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.4 - - [17\/Oct\/2016:06:35:45 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.4 - - [17\/Oct\/2016:06:36:59 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n<\/code><\/pre>\n<p>cluster-ip\u673a\u5236\u6709\u6548\u3002<\/p>\n<h5>2\u3001nodeport\u673a\u5236<\/h5>\n<p>k8s\u901a\u8fc7nodeport\u673a\u5236\u5b9e\u73b0\u7c7b\u4f3cdocker\u7684routing mesh\uff0c\u4f46\u5e95\u5c42\u673a\u5236\u548c\u539f\u7406\u662f\u4e0d\u540c\u7684\u3002<\/p>\n<p>k8s\u7684nodePort\u7684\u539f\u7406\u662f\u5728\u96c6\u7fa4\u4e2d\u7684\u6bcf\u4e2anode\u4e0a\u5f00\u4e86\u4e00\u4e2a\u7aef\u53e3\uff0c\u5c06\u8bbf\u95ee\u8be5\u7aef\u53e3\u7684\u6d41\u91cf\u5bfc\u5165\u5230\u8be5node\u4e0a\u7684kube-proxy\uff0c\u7136\u540e\u518d\u7531kube-proxy\u8fdb\u4e00\u6b65\u8bb2\u6d41\u91cf\u8f6c\u53d1\u7ed9\u8be5\u5bf9\u5e94\u8be5nodeport\u7684service\u7684alive\u7684pod\u4e0a\u3002<\/p>\n<p>\u6211\u4eec\u5148\u6765\u5220\u9664\u6389\u524d\u9762\u542f\u52a8\u7684my-nginx service\uff0c\u518d\u91cd\u65b0\u521b\u5efa\u652f\u6301nodeport\u7684\u65b0my-nginx service\u3002\u5728k8s delete service\u6709\u70b9\u8bb2\u7a76\uff0c\u6211\u4eec\u5220\u9664service\u7684\u76ee\u7684\u4e0d\u4ec5\u8981\u5220\u9664service\u201c\u7d22\u5f15\u201d\uff0c\u8fd8\u8981stop\u5e76\u5220\u9664\u8be5service\u5bf9\u5e94\u7684Pod\u4e2d\u7684\u6240\u6709docker container\u3002\u4f46\u5728k8s\u4e2d\uff0c\u76f4\u63a5\u5220\u9664service\u6216delete pods\u90fd\u65e0\u6cd5\u8ba9\u5bf9\u5e94\u7684container stop\u5e76deleted\uff0c\u800c\u662f\u8981\u901a\u8fc7delete service and delete deployment\u4e24\u6b65\u624d\u80fd\u5f7b\u5e95\u5220\u9664service\u3002<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~# kubectl delete svc my-nginx\nservice \"my-nginx\" deleted\n\nroot@iZ25cn4xxnvZ:~# kubectl get service my-nginx\nError from server: services \"my-nginx\" not found\n\n\/\/\u5bb9\u5668\u4f9d\u7136\u5728\u8fd0\u884c\nroot@iZ25cn4xxnvZ:~# kubectl get deployment my-nginx\nNAME       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nmy-nginx   2         2         2            2           20h\n\nroot@iZ25cn4xxnvZ:~# kubectl delete deployment my-nginx\ndeployment \"my-nginx\" deleted\n\n\u518d\u6267\u884cdocker ps\uff0c\u770b\u770b\u5bf9\u5e94docker container\u5e94\u8be5\u5df2\u7ecf\u88ab\u5220\u9664\u3002\n\n<\/code><\/pre>\n<p>\u91cd\u65b0\u521b\u5efa\u66b4\u9732nodeport\u7684my-nginx\u670d\u52a1\uff0c\u6211\u4eec\u5148\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684service\u6587\u4ef6\uff1a<\/p>\n<pre><code>\/\/my-nginx-svc.yaml\n\napiVersion: v1\nkind: Service\nmetadata:\n  name: my-nginx\n  labels:\n    run: my-nginx\nspec:\n  type: NodePort\n  ports:\n  - port: 80\n    nodePort: 30062\n    protocol: TCP\n  selector:\n    run: my-nginx\n<\/code><\/pre>\n<p>\u521b\u5efa\u670d\u52a1\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl create -f .\/my-nginx-svc.yaml\ndeployment \"my-nginx\" created\n<\/code><\/pre>\n<p>\u67e5\u770b\u670d\u52a1\u4fe1\u606f\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~\/k8stest\/demo# kubectl describe service my-nginx\nName:            my-nginx\nNamespace:        default\nLabels:            run=my-nginx\nSelector:        run=my-nginx\nType:            NodePort\nIP:            192.168.3.179\nPort:            &lt;unset&gt;    80\/TCP\nNodePort:        &lt;unset&gt;    30062\/TCP\nEndpoints:        172.16.57.3:80,172.16.99.2:80\nSession Affinity:    None\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u4e0e\u4e0a\u4e00\u6b21\u7684service\u4fe1\u606f\u76f8\u6bd4\uff0c\u8fd9\u91cc\u591a\u51fa\u4e00\u4e2a\u5c5e\u6027:NodePort 30062\/TCP\uff0c\u8fd9\u4e2a\u5c31\u662f\u6574\u4e2a\u670d\u52a1\u66b4\u9732\u5230\u96c6\u7fa4\u5916\u9762\u7684\u7aef\u53e3\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u901a\u8fc7\u8fd9\u4e24\u4e2anode\u7684\u516c\u7f51\u5730\u5740\u8bbf\u95ee\u4e00\u4e0b\u8fd9\u4e2a\u66b4\u9732\u7684nodeport\uff0c\u770b\u770bservice\u4e2d\u7684\u4e24\u4e2angnix container\u662f\u5426\u80fd\u6536\u5230request\uff1a<\/p>\n<p>\u901a\u8fc7\u516c\u7f51ip curl 30062\u7aef\u53e3:<\/p>\n<pre><code>curl -v x.x.x.x:30062\ncurl -v  y.y.y.y:30062\n<\/code><\/pre>\n<p>\u540c\u6837\uff0c\u6211\u4eec\u7528docker logs -f\u6765\u76d1\u63a7\u4e24\u4e2anginx container\u7684\u65e5\u5fd7\u8f93\u51fa\uff0c\u53ef\u4ee5\u770b\u5230\uff1a<\/p>\n<pre><code>nginx1:\n\n172.16.57.4 - - [17\/Oct\/2016:08:19:56 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.35.0\" \"-\"\n172.16.57.1 - - [17\/Oct\/2016:08:21:55 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.1 - - [17\/Oct\/2016:08:21:56 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.1 - - [17\/Oct\/2016:08:21:59 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.1 - - [17\/Oct\/2016:08:22:07 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.1 - - [17\/Oct\/2016:08:22:09 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n\nnginx2\uff1a\n\n172.16.57.0 - - [17\/Oct\/2016:08:22:05 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:08:22:06 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:08:22:08 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.0 - - [17\/Oct\/2016:08:22:09 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n<\/code><\/pre>\n<p>\u4e24\u4e2acontainer\u8f6e\u8be2\u5730\u6536\u5230\u5916\u90e8\u8f6c\u6765\u7684http request\u3002<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u5c06my-nginx\u670d\u52a1\u7684scale\u75312\u7f29\u51cf\u4e3a1\uff1a<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~# kubectl scale --replicas=1 deployment\/my-nginx\ndeployment \"my-nginx\" scaled\n<\/code><\/pre>\n<p>\u518d\u6b21\u6d4b\u8bd5nodeport\u673a\u5236\uff1a<\/p>\n<pre><code>curl -v x.x.x.x:30062\ncurl -v  y.y.y.y:30062\n<\/code><\/pre>\n<p>scale\u540e\uff0c\u53ea\u6709master\u4e0a\u7684my-nginx\u5b58\u6d3b\u3002\u7531\u4e8enodeport\u673a\u5236\uff0c\u6ca1\u6709my-nginx\u4e0a\u7684node\u6536\u5230\u8bf7\u6c42\u540e\uff0c\u5c06\u8bf7\u6c42\u8f6c\u7ed9kube-proxy\uff0c\u901a\u8fc7\u5185\u90e8clusterip\u673a\u5236\uff0c\u53d1\u7ed9\u6709my-nginx\u7684container\u3002<\/p>\n<pre><code>master\u4e0a\u7684nginx container\uff1a\n\n172.16.99.1 - - [18\/Oct\/2016:00:55:04 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n172.16.57.0 - - [18\/Oct\/2016:00:55:10 +0000] \"GET \/ HTTP\/1.1\" 200 612 \"-\" \"curl\/7.30.0\" \"-\"\n<\/code><\/pre>\n<p>nodeport\u673a\u5236\u6d4b\u8bd5ok\u3002\u901a\u8fc7netstat\u6211\u4eec\u53ef\u4ee5\u770b\u523030062\u7aef\u53e3\u662fnode\u4e0a\u7684kube-proxy\u76d1\u542c\u7684\u7aef\u53e3\uff0c\u56e0\u6b64\u5373\u4fbf\u8be5node\u4e0a\u6ca1\u6709nginx\u670d\u52a1container\u8fd0\u884c\uff0ckube-proxy\u4e5f\u4f1a\u8f6c\u53d1request\u3002<\/p>\n<pre><code>root@iZ25cn4xxnvZ:~# netstat -tnlp|grep 30062\ntcp6       0      0 :::30062                :::*                    LISTEN      22076\/kube-proxy\n<\/code><\/pre>\n<h4>\u516d\u3001\u5c3e\u58f0<\/h4>\n<p>\u5230\u8fd9\u91cc\uff0ck8s\u96c6\u7fa4\u5df2\u7ecf\u662f\u53ef\u7528\u7684\u4e86\u3002\u4f46\u8981\u7528\u597d\u80cc\u540e\u62e5\u670915\u5e74\u5bb9\u5668\u7ecf\u9a8c\u6c89\u6dc0\u7684k8s\uff0c\u8fd8\u6709\u5f88\u957f\u7684\u8def\u8981\u8d70\uff0c\u6bd4\u5982\u5b89\u88c5Addon\uff08DNS plugin\u7b49\uff09\u3001\u6bd4\u5982\u5b89\u88c5Dashboard\u7b49\u3002\u8fd9\u4e9b\u5728\u8fd9\u91cc\u6682\u4e0d\u63d0\u4e86\uff0c\u6587\u7ae0\u5df2\u7ecf\u5f88\u957f\u4e86\u3002\u540e\u7eed\u53ef\u80fd\u4f1a\u6709\u5355\u72ec\u6587\u7ae0\u8bf4\u660e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/tonybai.com\/2016\/10\/18\/learn-how-to-install-kubernetes-on-ubuntu\/ &nbsp; \u7531\u4e8e\u4e4b\u524d\u5728\u963f\u91cc\u4e91\u4e0a\u90e8\u7f72\u7684Docker 1.12.2\u7684Swarm\u96c6\u7fa4\u6ca1\u80fd\u6b63\u5e38\u5c55\u793a\u51fa\u5176\u6240\u5ba3\u79f0\u7684Routing mesh\u548cVIP\u7b49\u529f\u80fd\uff0c\u4e3a\u4e86\u6ee1\u8db3\u9879\u76ee\u9700\u8981\uff0c\u6211\u4eec\u53ea\u80fd\u8f6c\u5411\u53e6\u5916\u4e00\u79cd\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u548c\u670d\u52a1\u7f16\u6392\u5de5\u5177Kubernetes\u3002 \u6ce8\uff1a\u4e4b\u524dDocker1.12\u96c6\u7fa4\u7684Routing mesh\u548cVIP\u529f\u80fd\u5931\u6548\u7684\u95ee\u9898\uff0c\u7ecf\u8fc7\u5728github\u4e0a\u4e0eDocker\u5f00\u53d1\u4eba\u5458\u7684\u6c9f\u901a\uff0c\u76ee\u524d\u5df2\u7ecf\u5c06\u95ee\u9898\u539f\u56e0\u7f29\u5c0f\u5728\u963f\u91cc\u4e91\u7684\u7f51\u7edc\u4e0a\u9762\uff0c\u76ee\u524d\u770b\u662f\u7528\u4e8e\u627f\u8f7dvxlan\u6570\u636e\u901a\u4fe1\u7684\u8282\u70b94789 UDP\u7aef\u53e3\u4e0d\u901a\u7684\u95ee\u9898\uff0c\u9488\u5bf9\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u6b63\u5728\u901a\u8fc7\u963f\u91cc\u4e91\u552e\u540e\u5de5\u7a0b\u5e08\u505a\u8fdb\u4e00\u6b65\u6c9f\u901a\uff0c\u5e0c\u671b\u80fd\u627e\u51fa\u771f\u56e0\u3002 Kubernetes(\u4ee5\u4e0b\u79f0k8s)\u662fGoogle\u5f00\u6e90\u7684\u4e00\u6b3e\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u5de5\u5177\uff0c\u662fGoogle\u5185\u90e8\u5de5\u5177Borg\u7684\u201c\u5f00\u6e90\u7248\u201d\u3002\u80cc\u9760Google\u8fd9\u4e2a\u9ad8\u5927\u4e0a\u7684\u4eb2\u7239\uff0ck8s\u4e00\u51fa\u751f\u5c31\u5438\u5f15\u4e86\u8db3\u591f\u7684\u773c\u7403\uff0c\u5e76\u5f97\u5230\u4e86\u8bf8\u591a\u77e5\u540dIT\u516c\u53f8\u7684\u652f\u6301\u3002\u81f3\u4e8eGoogle\u5f00\u6e90k8s\u7684\u521d\u8877\uff0c\u7f8e\u597d\u7684\u8bf4\u6cd5\u662fGoogle\u5e0c\u671b\u901a\u8fc7\u8f93\u51fa\u81ea\u5df1\u5728\u5bb9\u5668\u9886\u57df\u957f\u8fbe10\u591a\u5e74\u7684\u4e30\u5bcc\u7ecf\u9a8c\uff0c\u5e2e\u52a9\u5bb9\u5668\u9886\u57df\u7684\u5f00\u53d1\u4eba\u5458\u548c\u5ba2\u6237\u63d0\u5347\u5f00\u53d1\u6548\u7387\u548c\u5bb9\u5668\u7ba1\u7406\u7684\u6863\u6b21\u3002\u4f46\u4efb\u4f55\u4e00\u79cd\u516c\u53f8\u884c\u4e3a\u90fd\u4f1a\u6709\u5176\u80cc\u540e\u7684\u77ed\u671f\u6216\u957f\u671f\u7684\u5546\u4e1a\u76ee\u7684\uff0cGoogle\u4f5c\u4e3a\u4e00\u4e2a\u5546\u4e1a\u516c\u53f8\u4e5f\u4e0d\u4f1a\u4f8b\u5916\u3002Google\u63a8\u51fak8s\u5230\u5e95\u4e3a\u5565\u5462\uff1f\u4f17\u8bf4\u7eb7\u7ead\u3002\u4e00\u79cd\u8bf4\u6cd5\u662fGoogle\u901a\u8fc7k8s\u8f93\u51fa\u5176\u5bb9\u5668\u5de5\u5177\u7684\u64cd\u4f5c\u548c\u4f7f\u7528\u65b9\u6cd5\u3001API\u6807\u51c6\u7b49\uff0c\u4e3a\u5168\u4e16\u754c\u7684\u5f00\u53d1\u4eba\u5458\u4f7f\u7528\u5176\u516c\u6709\u5bb9\u5668\u9884\u70ed\u5e76\u63d0\u4f9b\u201c\u96f6\u95e8\u69db\u201d\u4f53\u9a8c\u3002 k8s\u76ee\u524d\u662f\u516c\u8ba4\u7684\u6700\u5148\u8fdb\u7684\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u5de5\u5177\uff0c\u57281.0\u7248\u672c\u53d1\u5e03\u540e\uff0ck8s\u7684\u53d1\u5c55\u901f\u5ea6\u66f4\u52a0\u8fc5\u731b\uff0c\u5e76\u4e14\u5f97\u5230\u4e86\u5bb9\u5668\u751f\u6001\u5708\u5382\u5546\u7684\u5168\u529b\u652f\u6301\uff0c\u8fd9\u5305\u62eccoreos\u3001rancher\u7b49\uff0c\u8bf8\u591a\u63d0\u4f9b\u516c\u6709\u4e91\u670d\u52a1\u7684\u5382\u5546\u5728\u63d0\u4f9b\u5bb9\u5668\u670d\u52a1\u65f6\u4e5f\u90fd\u57fa\u4e8ek8s\u505a\u4e8c\u6b21\u5f00\u53d1\u6765\u63d0\u4f9b\u57fa\u7840\u8bbe\u65bd\u5c42\u7684\u652f\u6491\uff0c\u6bd4\u5982\u534e\u4e3a\u3002\u53ef\u4ee5\u8bf4k8s\u4e5f\u662fDocker\u8fdb\u519b\u5bb9\u5668\u96c6\u7fa4\u7ba1\u7406\u548c\u670d\u52a1\u7f16\u6392\u9886\u57df\u6700\u4e3a\u5f3a\u52b2\u7684\u7ade\u4e89\u5bf9\u624b\u3002 \u4e0d\u8fc7\u548c\u5df2\u7ecf\u539f\u751f\u96c6\u6210\u4e86\u96c6\u7fa4\u7ba1\u7406\u5de5\u5177swarmkit\u7684Docker\u76f8\u6bd4\uff0ck8s\u5728\u6587\u6863\u3001\u5b89\u88c5\u548c\u96c6\u7fa4\u7ba1\u7406\u65b9\u9762\u7684\u4f53\u9a8c\u8fd8\u6709\u5f88\u5927\u7684\u63d0\u5347\u7a7a\u95f4\u3002k8s\u6700\u65b0\u53d1\u5e03\u76841.4\u7248\u672c\u5c31\u662f\u4e00\u4e2a\u7740\u91cd\u5728\u8fd9\u4e9b\u65b9\u9762\u8fdb\u884c\u6539\u5584\u7684\u7248\u672c\u3002\u6bd4\u59821.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 \u4f46\u5bf9\u4e8e1.4\u7248\u672c\u4ee5\u524d\u76841.3.x\u7248\u672c\u6765\u8bf4\uff0c\u5b89\u88c5\u8d77\u6765\u7684\u8d76\u811a\u7528\u6700\u8fd1\u6d41\u884c\u7684\u7f51\u7edc\u8bcd\u6c47\u6765\u5f62\u5bb9\u5c31\u662f\u201c\u84dd\u7626\uff0c\u9999\u83c7\u201d\uff0c\u4f46\u6709\u4e9b\u65f6\u5019\u6211\u4eec\u8fd8\u4e0d\u5f97\u4e0d\u53bb\u6311\u6218\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u672c\u6587\u8981\u5e26\u5927\u5bb6\u4e86\u89e3\u7684\u5c31\u662f\u5229\u7528\u963f\u91cc\u4e91\u56fd\u5185\u533a\u7684ECS\u4e3b\u673a\uff0c\u5728Ubuntu 14.04.4\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5k8s 1.3.7\u7248\u672c\u7684\u65b9\u6cd5\u548c\u5b89\u88c5\u8fc7\u7a0b\u3002 \u96f6\u3001\u5fc3\u7406\u5efa\u8bbe \u7531\u4e8ek8s\u662fGoogle\u51fa\u54c1\uff0c\u5f88\u591a\u7ec4\u4ef6\u4e0egoogle\u662f\u201c\u6253\u65ad\u4e86\u9aa8\u5934\u8fd8\u8fde\u7740\u7b4b\u201d\uff0c\u56e0\u6b64\u5728\u56fd\u5185\u7f51\u7edc\u4e2d\u5b89\u88c5k8s\u662f\u9700\u8981\u5148\u8fdb\u884c\u5fc3\u7406\u5efa\u8bbe\u7684^_^\uff0c\u56e0\u4e3a\u548c\u6587\u6863\u4e2d\u5ba3\u79f0\u7684k8s 1.4\u7248\u7684\u5b89\u88c5\u6216docker [&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-110","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/110","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=110"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/110\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}