{"id":3686,"date":"2018-10-23T06:22:41","date_gmt":"2018-10-22T22:22:41","guid":{"rendered":"http:\/\/switch.linesno.com\/?p=3686"},"modified":"2018-10-23T06:22:41","modified_gmt":"2018-10-22T22:22:41","slug":"kubernetes%ef%bc%88k8s%ef%bc%89%e7%ac%ac%e4%b8%83%e9%83%a8%e5%88%86%e4%b9%8byaml%e6%96%87%e4%bb%b6%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"http:\/\/switch.linesno.com\/?p=3686","title":{"rendered":"kubernetes\uff08k8s\uff09\u7b2c\u4e03\u90e8\u5206\u4e4byaml\u6587\u4ef6\u8be6\u89e3"},"content":{"rendered":"<p># yaml\u683c\u5f0f\u7684pod\u5b9a\u4e49\u6587\u4ef6\u5b8c\u6574\u5185\u5bb9\uff1a<br \/>\napiVersion: v1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5fc5\u9009\uff0c\u7248\u672c\u53f7\uff0c\u4f8b\u5982v1<br \/>\nkind: Pod\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #\u5fc5\u9009\uff0cPod<br \/>\nmetadata:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #\u5fc5\u9009\uff0c\u5143\u6570\u636e<br \/>\nname: string\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5fc5\u9009\uff0cPod\u540d\u79f0<br \/>\nnamespace: string\u00a0\u00a0\u00a0\u00a0#\u5fc5\u9009\uff0cPod\u6240\u5c5e\u7684\u547d\u540d\u7a7a\u95f4<br \/>\nlabels:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u81ea\u5b9a\u4e49\u6807\u7b7e<br \/>\n&#8211; name: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u81ea\u5b9a\u4e49\u6807\u7b7e\u540d\u5b57<br \/>\nannotations:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u81ea\u5b9a\u4e49\u6ce8\u91ca\u5217\u8868<br \/>\n&#8211; name: string<br \/>\nspec:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #\u5fc5\u9009\uff0cPod\u4e2d\u5bb9\u5668\u7684\u8be6\u7ec6\u5b9a\u4e49<br \/>\ncontainers:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5fc5\u9009\uff0cPod\u4e2d\u5bb9\u5668\u5217\u8868<br \/>\n&#8211; name: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u5fc5\u9009\uff0c\u5bb9\u5668\u540d\u79f0<br \/>\nimage: string\u00a0\u00a0\u00a0\u00a0#\u5fc5\u9009\uff0c\u5bb9\u5668\u7684\u955c\u50cf\u540d\u79f0<br \/>\nimagePullPolicy: [Always | Never | IfNotPresent]\u00a0#\u83b7\u53d6\u955c\u50cf\u7684\u7b56\u7565 Alawys\u8868\u793a\u4e0b\u8f7d\u955c\u50cf IfnotPresent\u8868\u793a\u4f18\u5148\u4f7f\u7528\u672c\u5730\u955c\u50cf\uff0c\u5426\u5219\u4e0b\u8f7d\u955c\u50cf\uff0cNerver\u8868\u793a\u4ec5\u4f7f\u7528\u672c\u5730\u955c\u50cf<br \/>\ncommand: [string]\u00a0\u00a0\u00a0\u00a0#\u5bb9\u5668\u7684\u542f\u52a8\u547d\u4ee4\u5217\u8868\uff0c\u5982\u4e0d\u6307\u5b9a\uff0c\u4f7f\u7528\u6253\u5305\u65f6\u4f7f\u7528\u7684\u542f\u52a8\u547d\u4ee4<br \/>\nargs: [string]\u00a0\u00a0\u00a0\u00a0\u00a0#\u5bb9\u5668\u7684\u542f\u52a8\u547d\u4ee4\u53c2\u6570\u5217\u8868<br \/>\nworkingDir: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u5bb9\u5668\u7684\u5de5\u4f5c\u76ee\u5f55<br \/>\nvolumeMounts:\u00a0\u00a0\u00a0\u00a0#\u6302\u8f7d\u5230\u5bb9\u5668\u5185\u90e8\u7684\u5b58\u50a8\u5377\u914d\u7f6e<br \/>\n&#8211; name: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u5f15\u7528pod\u5b9a\u4e49\u7684\u5171\u4eab\u5b58\u50a8\u5377\u7684\u540d\u79f0\uff0c\u9700\u7528volumes[]\u90e8\u5206\u5b9a\u4e49\u7684\u7684\u5377\u540d<br \/>\nmountPath: string\u00a0\u00a0\u00a0\u00a0#\u5b58\u50a8\u5377\u5728\u5bb9\u5668\u5185mount\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u5e94\u5c11\u4e8e512\u5b57\u7b26<br \/>\nreadOnly: boolean\u00a0\u00a0\u00a0\u00a0#\u662f\u5426\u4e3a\u53ea\u8bfb\u6a21\u5f0f<br \/>\nports:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u9700\u8981\u66b4\u9732\u7684\u7aef\u53e3\u5e93\u53f7\u5217\u8868<br \/>\n&#8211; name: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u7aef\u53e3\u53f7\u540d\u79f0<br \/>\ncontainerPort: int\u00a0\u00a0\u00a0#\u5bb9\u5668\u9700\u8981\u76d1\u542c\u7684\u7aef\u53e3\u53f7<br \/>\nhostPort: int\u00a0\u00a0\u00a0\u00a0#\u5bb9\u5668\u6240\u5728\u4e3b\u673a\u9700\u8981\u76d1\u542c\u7684\u7aef\u53e3\u53f7\uff0c\u9ed8\u8ba4\u4e0eContainer\u76f8\u540c<br \/>\nprotocol: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u7aef\u53e3\u534f\u8bae\uff0c\u652f\u6301TCP\u548cUDP\uff0c\u9ed8\u8ba4TCP<br \/>\nenv:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5bb9\u5668\u8fd0\u884c\u524d\u9700\u8bbe\u7f6e\u7684\u73af\u5883\u53d8\u91cf\u5217\u8868<br \/>\n&#8211; name: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u73af\u5883\u53d8\u91cf\u540d\u79f0<br \/>\nvalue: string\u00a0\u00a0\u00a0\u00a0#\u73af\u5883\u53d8\u91cf\u7684\u503c<br \/>\nresources:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u8d44\u6e90\u9650\u5236\u548c\u8bf7\u6c42\u7684\u8bbe\u7f6e<br \/>\nlimits:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u8d44\u6e90\u9650\u5236\u7684\u8bbe\u7f6e<br \/>\ncpu: string\u00a0\u00a0\u00a0\u00a0#Cpu\u7684\u9650\u5236\uff0c\u5355\u4f4d\u4e3acore\u6570\uff0c\u5c06\u7528\u4e8edocker run &#8211;cpu-shares\u53c2\u6570<br \/>\nmemory: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u5185\u5b58\u9650\u5236\uff0c\u5355\u4f4d\u53ef\u4ee5\u4e3aMib\/Gib\uff0c\u5c06\u7528\u4e8edocker run &#8211;memory\u53c2\u6570<br \/>\nrequests:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u8d44\u6e90\u8bf7\u6c42\u7684\u8bbe\u7f6e<br \/>\ncpu: string\u00a0\u00a0\u00a0\u00a0#Cpu\u8bf7\u6c42\uff0c\u5bb9\u5668\u542f\u52a8\u7684\u521d\u59cb\u53ef\u7528\u6570\u91cf<br \/>\nmemory: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u5185\u5b58\u6e05\u695a\uff0c\u5bb9\u5668\u542f\u52a8\u7684\u521d\u59cb\u53ef\u7528\u6570\u91cf<br \/>\nlivenessProbe:\u00a0\u00a0\u00a0\u00a0\u00a0#\u5bf9Pod\u5185\u4e2a\u5bb9\u5668\u5065\u5eb7\u68c0\u67e5\u7684\u8bbe\u7f6e\uff0c\u5f53\u63a2\u6d4b\u65e0\u54cd\u5e94\u51e0\u6b21\u540e\u5c06\u81ea\u52a8\u91cd\u542f\u8be5\u5bb9\u5668\uff0c\u68c0\u67e5\u65b9\u6cd5\u6709exec\u3001httpGet\u548ctcpSocket\uff0c\u5bf9\u4e00\u4e2a\u5bb9\u5668\u53ea\u9700\u8bbe\u7f6e\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\u5373\u53ef<br \/>\nexec:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5bf9Pod\u5bb9\u5668\u5185\u68c0\u67e5\u65b9\u5f0f\u8bbe\u7f6e\u4e3aexec\u65b9\u5f0f<br \/>\ncommand: [string]\u00a0\u00a0#exec\u65b9\u5f0f\u9700\u8981\u5236\u5b9a\u7684\u547d\u4ee4\u6216\u811a\u672c<br \/>\nhttpGet:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5bf9Pod\u5185\u4e2a\u5bb9\u5668\u5065\u5eb7\u68c0\u67e5\u65b9\u6cd5\u8bbe\u7f6e\u4e3aHttpGet\uff0c\u9700\u8981\u5236\u5b9aPath\u3001port<br \/>\npath: string<br \/>\nport: number<br \/>\nhost: string<br \/>\nscheme: string<br \/>\nHttpHeaders:<br \/>\n&#8211; name: string<br \/>\nvalue: string<br \/>\ntcpSocket:\u00a0\u00a0\u00a0\u00a0\u00a0#\u5bf9Pod\u5185\u4e2a\u5bb9\u5668\u5065\u5eb7\u68c0\u67e5\u65b9\u5f0f\u8bbe\u7f6e\u4e3atcpSocket\u65b9\u5f0f<br \/>\nport: number<br \/>\ninitialDelaySeconds: 0\u00a0\u00a0#\u5bb9\u5668\u542f\u52a8\u5b8c\u6210\u540e\u9996\u6b21\u63a2\u6d4b\u7684\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u79d2<br \/>\ntimeoutSeconds: 0\u00a0\u00a0\u00a0#\u5bf9\u5bb9\u5668\u5065\u5eb7\u68c0\u67e5\u63a2\u6d4b\u7b49\u5f85\u54cd\u5e94\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d\u79d2\uff0c\u9ed8\u8ba41\u79d2<br \/>\nperiodSeconds: 0\u00a0\u00a0\u00a0\u00a0#\u5bf9\u5bb9\u5668\u76d1\u63a7\u68c0\u67e5\u7684\u5b9a\u671f\u63a2\u6d4b\u65f6\u95f4\u8bbe\u7f6e\uff0c\u5355\u4f4d\u79d2\uff0c\u9ed8\u8ba410\u79d2\u4e00\u6b21<br \/>\nsuccessThreshold: 0<br \/>\nfailureThreshold: 0<br \/>\nsecurityContext:<br \/>\nprivileged:false<br \/>\nrestartPolicy: [Always | Never | OnFailure]#Pod\u7684\u91cd\u542f\u7b56\u7565\uff0cAlways\u8868\u793a\u4e00\u65e6\u4e0d\u7ba1\u4ee5\u4f55\u79cd\u65b9\u5f0f\u7ec8\u6b62\u8fd0\u884c\uff0ckubelet\u90fd\u5c06\u91cd\u542f\uff0cOnFailure\u8868\u793a\u53ea\u6709Pod\u4ee5\u975e0\u9000\u51fa\u7801\u9000\u51fa\u624d\u91cd\u542f\uff0cNerver\u8868\u793a\u4e0d\u518d\u91cd\u542f\u8be5Pod<br \/>\nnodeSelector: obeject\u00a0\u00a0#\u8bbe\u7f6eNodeSelector\u8868\u793a\u5c06\u8be5Pod\u8c03\u5ea6\u5230\u5305\u542b\u8fd9\u4e2alabel\u7684node\u4e0a\uff0c\u4ee5key\uff1avalue\u7684\u683c\u5f0f\u6307\u5b9a<br \/>\nimagePullSecrets:\u00a0\u00a0\u00a0\u00a0#Pull\u955c\u50cf\u65f6\u4f7f\u7528\u7684secret\u540d\u79f0\uff0c\u4ee5key\uff1asecretkey\u683c\u5f0f\u6307\u5b9a<br \/>\n&#8211; name: string<br \/>\nhostNetwork:false\u00a0\u00a0\u00a0\u00a0\u00a0 #\u662f\u5426\u4f7f\u7528\u4e3b\u673a\u7f51\u7edc\u6a21\u5f0f\uff0c\u9ed8\u8ba4\u4e3afalse\uff0c\u5982\u679c\u8bbe\u7f6e\u4e3atrue\uff0c\u8868\u793a\u4f7f\u7528\u5bbf\u4e3b\u673a\u7f51\u7edc<br \/>\nvolumes:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5728\u8be5pod\u4e0a\u5b9a\u4e49\u5171\u4eab\u5b58\u50a8\u5377\u5217\u8868<br \/>\n&#8211; name: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u5171\u4eab\u5b58\u50a8\u5377\u540d\u79f0 \uff08volumes\u7c7b\u578b\u6709\u5f88\u591a\u79cd\uff09<br \/>\nemptyDir: {}\u00a0\u00a0\u00a0\u00a0\u00a0#\u7c7b\u578b\u4e3aemtyDir\u7684\u5b58\u50a8\u5377\uff0c\u4e0ePod\u540c\u751f\u547d\u5468\u671f\u7684\u4e00\u4e2a\u4e34\u65f6\u76ee\u5f55\u3002\u4e3a\u7a7a\u503c<br \/>\nhostPath: string\u00a0\u00a0\u00a0\u00a0\u00a0#\u7c7b\u578b\u4e3ahostPath\u7684\u5b58\u50a8\u5377\uff0c\u8868\u793a\u6302\u8f7dPod\u6240\u5728\u5bbf\u4e3b\u673a\u7684\u76ee\u5f55<br \/>\npath: string\u00a0\u00a0\u00a0\u00a0\u00a0#Pod\u6240\u5728\u5bbf\u4e3b\u673a\u7684\u76ee\u5f55\uff0c\u5c06\u88ab\u7528\u4e8e\u540c\u671f\u4e2dmount\u7684\u76ee\u5f55<br \/>\nsecret:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u7c7b\u578b\u4e3asecret\u7684\u5b58\u50a8\u5377\uff0c\u6302\u8f7d\u96c6\u7fa4\u4e0e\u5b9a\u4e49\u7684secre\u5bf9\u8c61\u5230\u5bb9\u5668\u5185\u90e8<br \/>\nscretname: string<br \/>\nitems:<br \/>\n&#8211; key: string<br \/>\npath: string<br \/>\nconfigMap:\u00a0\u00a0\u00a0\u00a0\u00a0#\u7c7b\u578b\u4e3aconfigMap\u7684\u5b58\u50a8\u5377\uff0c\u6302\u8f7d\u9884\u5b9a\u4e49\u7684configMap\u5bf9\u8c61\u5230\u5bb9\u5668\u5185\u90e8<br \/>\nname: string<br \/>\nitems:<br \/>\n&#8211; key: string<br \/>\npath: string<\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n","protected":false},"excerpt":{"rendered":"<p># yaml\u683c\u5f0f\u7684pod\u5b9a\u4e49\u6587\u4ef6\u5b8c\u6574\u5185\u5bb9\uff1a apiVersion: v1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#\u5fc5\u9009\uff0c\u7248\u672c\u53f7\uff0c\u4f8b\u5982v1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-3686","post","type-post","status-publish","format-standard","hentry","category-day"],"_links":{"self":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/3686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3686"}],"version-history":[{"count":1,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/3686\/revisions"}],"predecessor-version":[{"id":3687,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=\/wp\/v2\/posts\/3686\/revisions\/3687"}],"wp:attachment":[{"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3686"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/switch.linesno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}