{"id":2419,"date":"2020-10-28T17:29:31","date_gmt":"2020-10-28T09:29:31","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=2419"},"modified":"2022-12-12T16:40:26","modified_gmt":"2022-12-12T08:40:26","slug":"pod","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2020\/10\/28\/pod\/","title":{"rendered":"k8s\u96c6\u7fa4\u521b\u5efapod"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u96c6\u7fa4\u642d\u5efa\u5b8c\u6210\u540e\uff0c\u9700\u8981\u521b\u5efapod\u6765\u8fd0\u884c\u5e94\u7528\uff0c\u6bcf\u4e2apod\u4e2d\u53ef\u4ee5\u6709\u591a\u4e2a\u5bb9\u5668\uff0c\u6bcf\u4e2a\u5bb9\u5668\u8868\u793a\u63d0\u4f9b\u4e0d\u540c\u7684\u670d\u52a1\uff0c\u4e0b\u9762\u6f14\u793a\u4e00\u4e0b\u5982\u4f55\u521b\u5efapod\uff0c\u672c\u4f8b\u5b50\u4e2d\u7684\u521b\u5efapod\u7684\u955c\u50cf\u4eceharbor\u4e2d\u62c9\u53d6(\u65b9\u4fbf\uff0c\u4e0d\u9700\u8981\u5355\u72ec\u4e0a\u4f20\u955c\u50cf\u5230\u670d\u52a1\u5668\u4e0a)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u673a\u5668\u73af\u5883\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">master\uff1a10.88.15.216<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">worker1\uff1a10.88.15.219<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">worker2: 10.88.15.218<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u672c\u6559\u7a0b\u4e2d\u7684\u96c6\u7fa4\u4e00\u5171\u6709\u4e09\u53f0\uff0c\u5176\u4e2d\u4e00\u53f0\u4e3b\u4e24\u53f0\u4ece\uff0c\u9996\u5148\u9700\u8981\u4fdd\u8bc1\u6bcf\u4e2a\u673a\u5668\u90fd\u53ef\u4ee5\u767b\u5f55harbor\u4ed3\u5e93\uff0c\u914d\u7f6e\u65b9\u6cd5\uff1a\u5728\/etc\/docker\/daemon.json\u4e2d\u6dfb\u52a0\u914d\u7f6e\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"655\" height=\"209\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/1122.png\" alt=\"\" class=\"wp-image-2420\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/1122.png 655w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/1122-300x96.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/1122-600x191.png 600w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5176\u4e2d10.88.26.131\u8868\u793a\u4ed3\u5e93\u5730\u5740\uff0c\u5982\u679c\u662f\u57df\u540d\u5c31\u586b\u5199\u57df\u540d\uff0c\u586b\u5199\u5b8c\u6210\u540e\u91cd\u65b0\u542f\u52a8docker\u6216\u8005\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b9e\u73b0<strong>\u70ed\u66f4\u65b0\uff1akill -SIGHUP $(pidof dockerd)<\/strong>\uff0c\u5efa\u8bae\u70ed\u66f4\u65b0\uff0c\u4e0d\u9700\u8981\u91cd\u542fdocker\u8fdb\u7a0b<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u9700\u8981\u586b\u5199\u5728insecure-registries\u6a21\u5757\u4e2d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u547d\u4ee4\u7a97\u53e3\u8f93\u5165docker login  10.88.26.131\uff0c\u7136\u540e\u8f93\u5165\u4ed3\u5e93\u7684\u8d26\u53f7\u5bc6\u7801\u767b\u9646\u4ed3\u5e93\uff0c\u5982\u56fe\u8868\u793a\u6210\u529f<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"606\" height=\"205\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/2211.png\" alt=\"\" class=\"wp-image-2422\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/2211.png 606w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/2211-300x101.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/2211-600x203.png 600w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u4ed3\u5e93\u767b\u9646\u6210\u529f\u540e\uff0c\u5728\/root\/.docker\u76ee\u5f55\u4e0b\u751f\u6210config.json\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\u6b64\u6587\u4ef6\u8fdb\u884c\u52a0\u5bc6\uff0c\u6267\u884c\u547d\u4ee4cat  \/roo\/.docker\/config.json  | base64 ,\u52a0\u5bc6\u540e\u4e0b\u65b9\u751f\u6210\u52a0\u5bc6\u5b57\u7b26\u4e32\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"608\" height=\"240\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/888.png\" alt=\"\" class=\"wp-image-2423\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/888.png 608w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/888-300x118.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/888-600x237.png 600w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u901a\u8fc7config.json\u65b9\u5f0f\u521b\u5efasecret\u79d8\u94a5\u65b9\u6848\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u5982\u679cconfig.json\u4e2d\u914d\u7f6e\u4e86\u591a\u4e2a\u8ba4\u8bc1\u4ed3\u5e93\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u65e0\u6cd5\u62c9\u53d6\u955c\u50cf\u7684\u95ee\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u521b\u5efa\u79d8\u94a5\u8ba4\u8bc1\u6587\u4ef6secret.yaml(<strong>\u5efa\u8bae\u91c7\u7528\u6700\u4e0b\u65b9\u7684\u65b9\u6848\u6765\u521b\u5efasecret.yaml<\/strong>)\uff0c\u5185\u5bb9\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"252\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/8998.png\" alt=\"\" class=\"wp-image-2424\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/8998.png 601w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/8998-300x126.png 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u56fe\u4e2d\u7684\u4ee3\u7801\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Secret\nmetadata:\n    name: registrkey\n    namespace: test             #\u53ef\u4ee5\u6307\u5b9a\u547d\u540d\u7a7a\u95f4\ndata:\n    .dockerconfigjson:\ntype: kubernetes.io\/dockerconfigjson<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5176\u4e2dname\u8868\u793a\u81ea\u5df1\u8bbe\u7f6e\u7684\u4e00\u4e2a\u540d\u5b57(\u540e\u9762\u9700\u8981\u7528\u5230)\uff0c.dockerconfigjson\u540e\u9762\u52a0\u4e0a\u7b2c\u4e8c\u6b65\u751f\u6210\u7684\u52a0\u5bc6\u5b57\u7b26\u4e32\uff0c\u5176\u4f59\u9009\u9879\u6309\u7167\u56fe\u793a\u586b\u5199\u5373\u53ef\uff0c\u586b\u5199\u5b8c\u6210\u540e\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>kubectl  create -f   secret.yaml<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efa\u5b8c\u4e4b\u540e\u901a\u8fc7\u547d\u4ee4kubectl get secret registrkey -o yaml\u53ef\u4ee5\u67e5\u770b\u521b\u5efa\u60c5\u51b5\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"634\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-5.png\" alt=\"\" class=\"wp-image-2657\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-5.png 779w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-5-300x244.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-5-768x625.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-5-600x488.png 600w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u8ba4\u8bc1\u6587\u4ef6\u521b\u5efa\u5728default\u547d\u540d\u7a7a\u95f4\u4e2d\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u4e00\u4e2a\u95ee\u9898\uff1a\u5f53\u521b\u5efapod\u5230\u5176\u4ed6\u547d\u540d\u7a7a\u95f4\u7684\u65f6\u5019\uff0c\u4f1a\u51fa\u73b0\u65e0\u6cd5\u4ece\u4ed3\u5e93\u62c9\u53d6\u955c\u50cf\u7684\u60c5\u51b5\uff0c\u56e0\u6b64\u9700\u8981\u9488\u5bf9\u6bcf\u4e2a\u547d\u540d\u7a7a\u95f4\u521b\u5efa\u4e00\u4e2a\u8ba4\u8bc1\u6587\u4ef6(\u4e0d\u540c\u7684\u547d\u540d\u7a7a\u95f4\u53ef\u4ee5\u521b\u5efa\u76f8\u540c\u7684\u8ba4\u8bc1\u6587\u4ef6\u540d\u5b57)\uff0c\u7136\u540e\u5b9a\u4e49pod\u7684\u65f6\u5019\u6307\u5b9a\u5bf9\u5e94\u7684\u547d\u540d\u7a7a\u95f4\u7684\u8ba4\u8bc1\u6587\u4ef6\u540d\u5b57\u5373\u53ef\uff0c\u5177\u4f53\u65b9\u6cd5\u53c2\u8003\u6700\u4e0b\u65b9\u65b9\u6848<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u521b\u5efapod\u5b9a\u4e49\u6587\u4ef6nginx.yaml\uff0c\u4f8b\u5982\u521b\u5efa\u4e00\u4e2a\u53ea\u5305\u542b\u4e00\u4e2anginx\u5bb9\u5668\u7684pod\uff0c\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"870\" height=\"679\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-7.png\" alt=\"\" class=\"wp-image-2670\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-7.png 870w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-7-300x234.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-7-768x599.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-7-600x468.png 600w\" sizes=\"auto, (max-width: 870px) 100vw, 870px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u56fe\u4e2d\u7684pod\u521b\u5efa\u5728\u9ed8\u8ba4\u7684\u547d\u540d\u7a7a\u95f4default\u4e2d\uff0cregistrkey\u8868\u793a\u7b2c\u4e09\u6b65\u4e2d\u5b9a\u4e49\u7684\u79d8\u94a5\u8ba4\u8bc1\u6587\u4ef6\u7684\u540d\u5b57\uff0cimage\u8868\u793a\u8981\u4ece\u4ed3\u5e93\u4e2d\u62c9\u53d6\u7684\u955c\u50cf\u540d\u5b57\uff0ccontainerPort\u8868\u793a\u5bb9\u5668\u5185\u90e8\u7684\u7aef\u53e3\uff0chostPort\u8868\u793a\u6620\u5c04\u51fa\u6765\u7684\u4e3b\u673a\u7aef\u53e3(\u96c6\u7fa4\u9700\u8981\u901a\u8fc7Service\u5bf9\u5916\u7edf\u4e00\u63d0\u4f9b\u670d\u52a1\uff0c\u56e0\u6b64\u53ef\u4e0d\u6620\u5c04\u4e3b\u673a\u7aef\u53e3)<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\u4e0a\u56fe\u4e2d\u7684apiVersion \u7684\u540d\u5b57\u4e0d\u662f\u4e71\u5199\u7684\uff0c\u53ef\u4ee5\u901a\u8fc7kubectl api-versions\u67e5\u8be2\u5e76\u586b\u5199\uff0ckind\u4e5f\u8981\u6839\u636e\u5b9e\u9645\u7684\u7c7b\u578b\u6765\u586b\u5199\uff0c\u6bd4\u5982\u6b64pod\u901a\u8fc7deployment\u63a7\u5236\u5668\u521b\u5efa\uff0c\u90a3\u4e48kind\u4f4d\u7f6e\u5c31\u5199deployment\u5373\u53ef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u6267\u884c\u547d\u4ee4\u521b\u5efapod\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>kubectl create -f  nginx.yaml<\/strong>  &#8211;record<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u52a0\u4e86&#8211;record\u53c2\u6570\u540e\uff0c\u5728\u67e5\u8be2\u7248\u672c\u66f4\u65b0\u5386\u53f2\u7684\u65f6\u5019\u5c31\u53ef\u4ee5\u770b\u5230\u6bcf\u4e2a\u7248\u672c\u4f7f\u7528\u7684\u547d\u4ee4\u4e86<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u547d\u4ee4kubectl get pod\u53ef\u4ee5\u67e5\u770b\u5f53\u524dpod\u7684\u8fd0\u884c\u72b6\u6001\u4e3arunning\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"183\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-8.png\" alt=\"\" class=\"wp-image-2669\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-8.png 735w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-8-300x75.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-8-600x149.png 600w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6267\u884c\u547d\u4ee4<strong>kubectl  describe pod  +\u540d\u5b57<\/strong>  \u53ef\u4ee5\u67e5\u770b\u5f53\u524dpod\u8fd0\u884c\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"213\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-11.png\" alt=\"\" class=\"wp-image-2671\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-11.png 840w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-11-300x76.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-11-768x195.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-11-600x152.png 600w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6267\u884c\u547d\u4ee4kubectl get pods -o wide\u53ef\u4ee5\u67e5\u770b\u5177\u4f53\u8fd0\u884c\u5728\u54ea\u4e2a\u8282\u70b9\u4e0a\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"907\" height=\"357\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-13.png\" alt=\"\" class=\"wp-image-2687\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-13.png 907w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-13-300x118.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-13-768x302.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-13-600x236.png 600w\" sizes=\"auto, (max-width: 907px) 100vw, 907px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">7\u3001\u6b64\u65f6\u5728\u6d4f\u89c8\u5668\u8f93\u5165IP\u5730\u5740\u52a0\u7aef\u53e3\u8bbf\u95ee\u9875\u9762\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"310\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-9.png\" alt=\"\" class=\"wp-image-2672\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-9.png 783w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-9-300x119.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-9-768x304.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-9-600x238.png 600w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u662f\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u4e00\u4e2a\u521b\u5efanginx\u7684pod\u4f8b\u5b50\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: nginx                     #deployment\u540d\u5b57\n  namespace: gongguan             #\u547d\u540d\u7a7a\u95f4\n  labels:\n    name: deployment-nginx\nspec:\n  selector:\n    matchLabels:\n      app: nginx-pod             #\u7ba1\u7406\u6807\u7b7e\u4e3anginx-pod\u7684pod\n  replicas: 2                    #\u526f\u672c\u4e2a\u6570\u4e3a2\n  template:                      #\u521b\u5efapod\u7684\u6a21\u677f\n    metadata:\n      labels:\n        app: nginx-pod           #pod\u6807\u7b7e\uff0c\u6807\u7b7e\u9009\u62e9\u5668\u5c31\u662f\u9009\u62e9\u8fd9\u4e2a\u6807\u7b7e\n    spec:\n      containers:\n      - name: nginx\n        image: nginx\n        ports:\n        - containerPort: 80\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">yaml\u6587\u4ef6\u7684pod\u5b9a\u4e49\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b(\u4f9b\u53c2\u8003)\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># yaml\u683c\u5f0f\u7684pod\u5b9a\u4e49\u6587\u4ef6\u5b8c\u6574\u5185\u5bb9\uff1a\napiVersion: v1                    #\u5fc5\u9009\uff0c\u7248\u672c\u53f7\uff0c\u4f8b\u5982v1\nkind: Pod                         #\u5fc5\u9009\uff0cPod\nmetadata:                         #\u5fc5\u9009\uff0c\u5143\u6570\u636e\n  name: string                    #\u5fc5\u9009\uff0cPod\u540d\u79f0\n  namespace: string               #\u5fc5\u9009\uff0cPod\u6240\u5c5e\u7684\u547d\u540d\u7a7a\u95f4\n  labels:                         #\u81ea\u5b9a\u4e49\u6807\u7b7e\n    - name: string                #\u81ea\u5b9a\u4e49\u6807\u7b7e\u540d\u5b57\n  annotations:                    #\u81ea\u5b9a\u4e49\u6ce8\u91ca\u5217\u8868\n    - name: string\nspec:                             #\u5fc5\u9009\uff0cPod\u4e2d\u5bb9\u5668\u7684\u8be6\u7ec6\u5b9a\u4e49\n  containers:                     #\u5fc5\u9009\uff0cPod\u4e2d\u5bb9\u5668\u5217\u8868\n  - name: string                  #\u5fc5\u9009\uff0c\u5bb9\u5668\u540d\u79f0\n    image: string                 #\u5fc5\u9009\uff0c\u5bb9\u5668\u7684\u955c\u50cf\u540d\u79f0\n    imagePullPolicy: &#91;Always | Never | IfNotPresent] #\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\uff0c\u5982\u679c\u6807\u7b7e\u4e3alatest\u90a3\u4e48\u9ed8\u8ba4\u4e3aAlways\uff0c\u5982\u679c\u662f\u5176\u4ed6\u6807\u7b7e\uff0c\u90a3\u4e48\u5c31\u662fIfNotPresent\n    command: &#91;string]             #\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\n    args: &#91;string]                #\u5bb9\u5668\u7684\u542f\u52a8\u547d\u4ee4\u53c2\u6570\u5217\u8868\n    workingDir: string            #\u5bb9\u5668\u7684\u5de5\u4f5c\u76ee\u5f55\n    volumeMounts:                 #\u6302\u8f7d\u5230\u5bb9\u5668\u5185\u90e8\u7684\u5b58\u50a8\u5377\u914d\u7f6e\n    - name: string                #\u5f15\u7528pod\u5b9a\u4e49\u7684\u5171\u4eab\u5b58\u50a8\u5377\u7684\u540d\u79f0\uff0c\u9700\u7528volumes&#91;]\u90e8\u5206\u5b9a\u4e49\u7684\u7684\u5377\u540d\n      mountPath: string           #\u5b58\u50a8\u5377\u5728\u5bb9\u5668\u5185mount\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u5e94\u5c11\u4e8e512\u5b57\u7b26\n      readOnly: boolean           #\u662f\u5426\u4e3a\u53ea\u8bfb\u6a21\u5f0f\uff0c\u9ed8\u8ba4\u4e3a\u8bfb\u5199\u6a21\u5f0f\n    ports:                        #\u5bb9\u5668\u9700\u8981\u66b4\u9732\u7684\u7aef\u53e3\u53f7\u5217\u8868\n    - name: string                #\u7aef\u53e3\u53f7\u540d\u79f0\n      containerPort: int          #\u5bb9\u5668\u9700\u8981\u76d1\u542c\u7684\u7aef\u53e3\u53f7\n      hostPort: int               #\u5bb9\u5668\u6240\u5728\u4e3b\u673a\u9700\u8981\u76d1\u542c\u7684\u7aef\u53e3\u53f7\uff0c\u9ed8\u8ba4\u4e0eContainer\u76f8\u540c\uff0c\u8bbe\u4e3ahostPort\u65f6\uff0c\u540c\u4e00\u53f0\u5bbf\u4e3b\u673a\u65e0\u6cd5\u542f\u52a82\u4e2a\u526f\u672c\n      protocol: string            #\u7aef\u53e3\u534f\u8bae\uff0c\u652f\u6301TCP\u548cUDP\uff0c\u9ed8\u8ba4TCP\n    env:                          #\u5bb9\u5668\u8fd0\u884c\u524d\u9700\u8bbe\u7f6e\u7684\u73af\u5883\u53d8\u91cf\u5217\u8868\n    - name: string                #\u73af\u5883\u53d8\u91cf\u540d\u79f0\n      value: string               #\u73af\u5883\u53d8\u91cf\u7684\u503c\n    resources:                    #\u8d44\u6e90\u9650\u5236\u548c\u8bf7\u6c42\u7684\u8bbe\u7f6e\n      limits:                     #\u8d44\u6e90\u9650\u5236\u7684\u8bbe\u7f6e\n        cpu: string               #Cpu\u7684\u9650\u5236\uff0c\u5355\u4f4d\u4e3acore\u6570\uff0c\u5c06\u7528\u4e8edocker run --cpu-shares\u53c2\u6570\n        memory: string            #\u5185\u5b58\u9650\u5236\uff0c\u5355\u4f4d\u53ef\u4ee5\u4e3aMib\/Gib\uff0c\u5c06\u7528\u4e8edocker run --memory\u53c2\u6570\n      requests:                   #\u8d44\u6e90\u8bf7\u6c42\u7684\u8bbe\u7f6e\n        cpu: string               #cpu\u8bf7\u6c42\uff0c\u5355\u4f4d\u4e3acore\u6570\uff0c\u5bb9\u5668\u542f\u52a8\u7684\u521d\u59cb\u53ef\u7528\u6570\u91cf\n        memory: string            #\u5185\u5b58\u8bf7\u6c42\uff0c\u5355\u4f4d\u4e3aMiB\uff0cGiB\u7b49\uff0c\u5bb9\u5668\u542f\u52a8\u7684\u521d\u59cb\u53ef\u7528\u6570\u91cf\n    livenessProbe:                #\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\n      exec:                       #\u5bf9Pod\u5bb9\u5668\u5185\u68c0\u67e5\u65b9\u5f0f\u8bbe\u7f6e\u4e3aexec\u65b9\u5f0f\n        command: &#91;string]         #exec\u65b9\u5f0f\u9700\u8981\u5236\u5b9a\u7684\u547d\u4ee4\u6216\u811a\u672c\n      httpGet:                    #\u5bf9Pod\u5185\u4e2a\u5bb9\u5668\u5065\u5eb7\u68c0\u67e5\u65b9\u6cd5\u8bbe\u7f6e\u4e3aHttpGet\uff0c\u9700\u8981\u5236\u5b9aPath\u3001port\n        path: string\n        port: number\n        host: string\n        scheme: string\n        HttpHeaders:\n        - name: string\n          value: string\n      tcpSocket:                 #\u5bf9Pod\u5185\u4e2a\u5bb9\u5668\u5065\u5eb7\u68c0\u67e5\u65b9\u5f0f\u8bbe\u7f6e\u4e3atcpSocket\u65b9\u5f0f\n         port: number\n       initialDelaySeconds: 0    #\u5bb9\u5668\u542f\u52a8\u5b8c\u6210\u540e\u9996\u6b21\u63a2\u6d4b\u7684\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u79d2\n       timeoutSeconds: 0         #\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\uff0c\u82e5\u8d85\u8fc7\u8be5\u65f6\u95f4\uff0c\u5224\u65ad\u4e3a\u4e0d\u5065\u5eb7\uff0c\u5c06\u91cd\u542f\u5bb9\u5668\n       periodSeconds: 0          #\u5bf9\u5bb9\u5668\u5065\u5eb7\u68c0\u67e5\u7684\u5b9a\u671f\u63a2\u6d4b\u65f6\u95f4\u8bbe\u7f6e\uff0c\u5355\u4f4d\u79d2\uff0c\u9ed8\u8ba410\u79d2\u4e00\u6b21\n       successThreshold: 0\n       failureThreshold: 0\n       securityContext:\n         privileged:false\n    restartPolicy: &#91;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\n    nodeSelector: obeject        #\u8bbe\u7f6eNodeSelector\u8868\u793a\u5c06\u8be5Pod\u8c03\u5ea6\u5230\u5305\u542b\u8fd9\u4e2alabel\u7684node\u4e0a\uff0c\u4ee5key\uff1avalue\u7684\u683c\u5f0f\u6307\u5b9a\n    imagePullSecrets:            #Pull\u955c\u50cf\u65f6\u4f7f\u7528\u7684secret\u540d\u79f0\uff0c\u4ee5key\uff1asecretkey\u683c\u5f0f\u6307\u5b9a\n    - name: string\n    hostNetwork:false            #\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\uff0c\u4e00\u53f0\u673a\u5668\u65e0\u6cd5\u542f\u52a82\u4e2a\u526f\u672c\n    volumes:                     #\u5728\u8be5pod\u4e0a\u5b9a\u4e49\u5171\u4eab\u5b58\u50a8\u5377\u5217\u8868\n    - name: string               #\u5171\u4eab\u5b58\u50a8\u5377\u540d\u79f0 \uff08volumes\u7c7b\u578b\u6709\u5f88\u591a\u79cd\uff09\n      emptyDir: {}               #\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\n      hostPath: string           #\u7c7b\u578b\u4e3ahostPath\u7684\u5b58\u50a8\u5377\uff0c\u8868\u793a\u6302\u8f7dPod\u6240\u5728\u5bbf\u4e3b\u673a\u7684\u76ee\u5f55\n        path: string             #Pod\u6240\u5728\u5bbf\u4e3b\u673a\u7684\u76ee\u5f55\uff0c\u5c06\u88ab\u7528\u4e8e\u540c\u671f\u4e2dmount\u7684\u76ee\u5f55\n      secret:                    #\u7c7b\u578b\u4e3asecret\u7684\u5b58\u50a8\u5377\uff0c\u6302\u8f7d\u96c6\u7fa4\u9884\u5b9a\u4e49\u7684secre\u5bf9\u8c61\u5230\u5bb9\u5668\u5185\u90e8\n        scretname: string  \n        items:     \n        - key: string\n          path: string\n      configMap:                 #\u7c7b\u578b\u4e3aconfigMap\u7684\u5b58\u50a8\u5377\uff0c\u6302\u8f7d\u9884\u5b9a\u4e49\u7684configMap\u5bf9\u8c61\u5230\u5bb9\u5668\u5185\u90e8\n        name: string\n        items:\n        - key: string\n          path: string<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>\u9644\u5f55\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u521b\u5efascrect.yaml\u6587\u4ef6\u7684\u65f6\u5019\u6307\u5b9a\u547d\u4ee4\u7a7a\u95f4\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"675\" height=\"261\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-8.png\" alt=\"\" class=\"wp-image-2661\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-8.png 675w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-8-300x116.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-8-600x232.png 600w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u521b\u5efapod\u7684\u65f6\u5019\u6307\u5b9a\u76f8\u540c\u547d\u540d\u7a7a\u95f4\uff0c\u5e76\u6307\u5b9a\u8ba4\u8bc1\u6587\u4ef6\u540d\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"679\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-3.png\" alt=\"\" class=\"wp-image-2663\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-3.png 872w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-3-300x234.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-3-768x598.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-3-600x467.png 600w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u6267\u884c\u547d\u4ee4\u540e\u53ef\u4ee5\u770b\u5230pod\u5df2\u7ecf\u521b\u5efa\u6210\u529f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"804\" height=\"214\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-9.png\" alt=\"\" class=\"wp-image-2664\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-9.png 804w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-9-300x80.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-9-768x204.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-9-600x160.png 600w\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u4e0d\u540c\u7684\u547d\u540d\u7a7a\u95f4\u90fd\u9700\u8981\u521b\u5efa\u8ba4\u8bc1\u6587\u4ef6\uff0c\u5176\u4e2d\u8ba4\u8bc1\u540d\u53ef\u4ee5\u76f8\u540c\uff0c\u7136\u540e\u5728\u521b\u5efapod\u7684\u65f6\u5019\u6307\u5b9a\u5bf9\u5e94\u7684\u547d\u540d\u7a7a\u95f4\u548c\u5bf9\u5e94\u7684\u8ba4\u8bc1\u540d\uff0c\u5426\u5219\u4f1a\u51fa\u73b0\u62c9\u53d6\u955c\u50cf\u51fa\u9519<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>\u91cd\u8981\uff01\uff01\uff01\uff01\uff01<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efa\u5b8cpod\u540e\u8fd8\u9700\u8981\u521b\u5efa\u670d\u52a1\uff0c\u5c06pod\u670d\u52a1\u66b4\u9732\u51fa\u6765\uff0c \u901a\u8fc7\u521b\u5efaService\uff0c\u53ef\u4ee5\u4e3a\u4e00\u7ec4\u5177\u6709\u76f8\u540c\u529f\u80fd\u7684\u5bb9\u5668 \u5e94\u7528\u63d0\u4f9b\u4e00\u4e2a\u7edf\u4e00\u7684\u5165\u53e3\u5730\u5740\uff0c\u5e76\u4e14\u5c06\u8bf7\u6c42\u8d1f\u8f7d\u5206\u53d1\u5230\u540e\u7aef\u7684\u5404\u4e2a\u5bb9\u5668\u5e94\u7528\u4e0a\u3002<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong>\u521b\u5efa\u79d8\u94a5\u8ba4\u8bc1\u6587\u4ef6secret.yaml<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6709\u5982\u4e0b\u4e24\u79cd\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> <strong>data<\/strong>\uff1a\u4f7f\u7528 data \u5b57\u6bb5\u65f6\uff0c\u53d6\u503c\u7684\u5185\u5bb9\u5fc5\u987b\u662f base64 \u7f16\u7801\u7684 <\/li><li> <strong>stringData<\/strong>\uff1a\u4f7f\u7528 stringData \u65f6\uff0c\u66f4\u4e3a\u65b9\u4fbf\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u5c06\u53d6\u503c\u4ee5\u660e\u6587\u7684\u65b9\u5f0f\u5199\u5728 yaml \u6587\u4ef6\u4e2d <\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u5728 yaml \u4e2d\u5b9a\u4e49 data\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5047\u8bbe\u60a8\u8981\u4fdd\u5b58&nbsp;<code>username=admin<\/code>&nbsp;\u548c&nbsp;<code>password=1f2d1e2e67df<\/code>&nbsp;\u5230 Secret \u4e2d\uff0c\u8bf7\u5148\u5c06\u6570\u636e\u7684\u503c\u8f6c\u5316\u4e3a base64 \u7f16\u7801\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo -n 'admin' | base64\nYWRtaW4=\necho -n '1f2d1e2e67df' | base64\nMWYyZDFlMmU2N2Rm<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efa secret.yaml \u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\u6240\u793a\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret                 \/\/\u81ea\u5b9a\u4e49\u540d\u79f0\n  namespace: test                \/\/\u8868\u793a\u547d\u540d\u7a7a\u95f4\ntype: Opaque\ndata:\n  username: YWRtaW4=\n  password: MWYyZDFlMmU2N2Rm<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540e\u6267\u884c\u547d\u4ee4kubectl apply -f  secret.yaml\u521b\u5efa\u5373\u53ef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5728 yaml \u4e2d\u5b9a\u4e49 stringData\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6709\u65f6\uff0c\u60a8\u5e76\u4e0d\u60f3\u5148\u5c06\u7528\u6237\u540d\u548c\u5bc6\u7801\u8f6c\u6362\u4e3a base64 \u7f16\u7801\u4e4b\u540e\u518d\u521b\u5efa Secret\uff0c\u5219\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u5b9a\u4e49 stringData \u6765\u8fbe\u6210\uff0c\u6b64\u65f6 stringData \u4e2d\u7684\u53d6\u503c\u90e8\u5206\u5c06\u88ab apiserver \u81ea\u52a8\u8fdb\u884c base64 \u7f16\u7801\u4e4b\u540e\u518d\u4fdd\u5b58<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efa\u6587\u4ef6 secret.yaml\uff0c\u5185\u5bb9\u5982\u4e0b\u6240\u793a\uff1a  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Secret\nmetadata:\n  name: mysecret\n  namespace: test         \ntype: Opaque\nstringData:\n  username: admin\n  password: 1f2d1e2e67df<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540e\u6267\u884c\u547d\u4ee4kubectl apply -f  secret.yaml\u521b\u5efa\u5373\u53ef <\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>\u9759\u6001pod<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9759\u6001Pod\u662f\u7531kubelet\u8fdb\u884c\u7ba1\u7406\u7684\u4ec5\u5b58\u5728\u4e8e\u7279\u5b9aNode\u4e0a\u7684Pod\u3002\u5b83\u4eec\u4e0d \u80fd \u901a \u8fc7 API Server \u8fdb \u884c \u7ba1 \u7406 \uff0c \u65e0 \u6cd5 \u4e0e ReplicationController \u3001Deployment\u6216\u8005DaemonSet\u8fdb\u884c\u5173\u8054\uff0c\u5e76\u4e14kubelet\u65e0\u6cd5\u5bf9\u5b83\u4eec\u8fdb\u884c\u5065\u5eb7\u68c0\u67e5\u3002\u9759\u6001Pod\u603b\u662f\u7531kubelet\u521b\u5efa\u7684\uff0c\u5e76\u4e14\u603b\u5728kubelet\u6240\u5728\u7684Node<br>\u4e0a\u8fd0\u884c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efa\u9759\u6001Pod\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a\u914d\u7f6e\u6587\u4ef6\u65b9\u5f0f\u548cHTTP\u65b9\u5f0f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00<strong>\u3001\u914d\u7f6e\u6587\u4ef6\u65b9\u5f0f\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u6267\u884c\u547d\u4ee4systemctl status kubelet\u67e5\u770bkubenet\u7684\u8fdb\u7a0b\u72b6\u6001\uff0c\u53ef\u4ee5\u770b\u5230\u914d\u7f6e\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"195\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3.png\" alt=\"\" class=\"wp-image-6187\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3.png 702w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3-300x83.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3-600x167.png 600w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u67e5\u770b\u914d\u7f6e\u6587\u4ef6config.yaml\uff0c\u53ef\u4ee5\u770b\u5230\u9759\u6001pod\u7684\u6587\u4ef6\u8def\u5f84\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"239\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4.png\" alt=\"\" class=\"wp-image-6188\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4-300x102.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4-600x203.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u8fdb\u5165\u8def\u5f84\/etc\/kubernetes\/manifests\uff0c\u521b\u5efanginx.yaml\u6587\u4ef6\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"280\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5.png\" alt=\"\" class=\"wp-image-6189\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5.png 704w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5-300x119.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5-600x239.png 600w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u9759\u6001pod\u4e0d\u53ea\u662f\u5728master\u8282\u70b9\u624d\u80fd\u521b\u5efa\uff0c\u5728\u4efb\u4f55\u4e00\u4e2a\u8282\u70b9\u7684\/etc\/kubernetes\/manifests\u76ee\u5f55\u4e0b\u653e\u7f6epod\u6587\u4ef6\u540e\u90fd\u53ef\u4ee5\u521b\u5efa\u51fa\u9759\u6001pod<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u8fc7\u4e00\u4f1a\u5c31\u53ef\u4ee5\u770b\u5230\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3anginx-test-gong\u7684pod ,\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"188\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6.png\" alt=\"\" class=\"wp-image-6190\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6.png 702w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6-300x80.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6-600x161.png 600w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u7531\u4e8e\u9759\u6001pod\u65e0\u6cd5\u901a\u8fc7api-server\u6765\u7ba1\u7406\uff0c\u56e0\u6b64\u5220\u9664\u6b64pod\u540e\uff0c\u72b6\u6001\u5c06\u53d8\u4e3apending\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"247\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/7.png\" alt=\"\" class=\"wp-image-6191\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/7.png 705w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/7-300x105.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/7-600x210.png 600w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u5982\u679c\u8981\u5f7b\u5e95\u5220\u9664\uff0c\u53ea\u80fd\u53bb\u76f8\u5e94\u7684\u8282\u70b9\u4e0a\uff0c\u5c06yaml\u6587\u4ef6\u5220\u9664\u5373\u53ef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4e8c\u3001HTTP\u65b9\u5f0f\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u8bbe\u7f6ekubelet\u7684\u542f\u52a8\u53c2\u6570\u201c&#8211;manifest-url\u201d\uff0ckubelet\u5c06\u4f1a\u5b9a\u671f\u4ece\u8be5URL\u5730\u5740\u4e0b\u8f7dPod\u7684\u5b9a\u4e49\u6587\u4ef6\uff0c\u5e76\u4ee5.yaml\u6216.json\u6587\u4ef6\u7684\u683c\u5f0f\u8fdb\u884c\u89e3<br>\u6790\uff0c\u7136\u540e\u521b\u5efaPod\u3002\u5176\u5b9e\u73b0\u65b9\u5f0f\u4e0e\u914d\u7f6e\u6587\u4ef6\u65b9\u5f0f\u662f\u4e00\u81f4\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u96c6\u7fa4\u642d\u5efa\u5b8c\u6210\u540e\uff0c\u9700\u8981\u521b\u5efapod\u6765\u8fd0\u884c\u5e94\u7528\uff0c\u6bcf\u4e2apod\u4e2d\u53ef\u4ee5\u6709\u591a\u4e2a\u5bb9\u5668\uff0c\u6bcf\u4e2a\u5bb9\u5668\u8868\u793a\u63d0\u4f9b\u4e0d\u540c\u7684\u670d\u52a1\uff0c\u4e0b\u9762\u6f14\u793a\u4e00\u4e0b [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2431,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,29],"tags":[],"class_list":["post-2419","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kubernetes","category-yunwei"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2419"}],"version-history":[{"count":45,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2419\/revisions"}],"predecessor-version":[{"id":10928,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2419\/revisions\/10928"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/2431"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}