{"id":2642,"date":"2020-12-22T18:46:43","date_gmt":"2020-12-22T10:46:43","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=2642"},"modified":"2022-12-12T17:19:23","modified_gmt":"2022-12-12T09:19:23","slug":"pod-2","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2020\/12\/22\/pod-2\/","title":{"rendered":"k8s\u4e4b\u7ba1\u7406pod"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u521b\u5efa\u5b8cpod\u540e\uff0c \u5982\u679c\u4e0d\u6307\u5b9a\u547d\u540d\u7a7a\u95f4\uff0c\u9ed8\u8ba4\u90fd\u662f\u521b\u5efa\u5230default\u7684\u547d\u4ee4\u7a7a\u95f4\uff0c\u53ef\u4ee5\u901a\u8fc7dashborad\u4e2d\u7684namespace\u4e2d\u67e5\u770bdefault\u547d\u4ee4\u7a7a\u95f4\u4e2d\u7684pod\u60c5\u51b5<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1apod\u5b9a\u4e49\u6a21\u677fnginx.yaml\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"869\" height=\"677\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-9.png\" alt=\"\" class=\"wp-image-2685\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-9.png 869w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-9-300x234.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-9-768x598.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-9-600x467.png 600w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>\u5220\u9664pod:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u9996\u5148\u67e5\u8be2pod\u4fe1\u606f\uff1a\u5728\u7ba1\u7406\u8282\u70b9\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>kubectl  get pod -n  sf-one<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"179\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-6.png\" alt=\"\" class=\"wp-image-2649\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-6.png 786w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-6-300x68.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-6-768x175.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-6-600x137.png 600w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u53ef\u770b\u51fa\u547d\u540d\u7a7a\u95f4sf-one\u4e2d\u6709\u4e00\u4e2aPod\u76842\u4e2a\u526f\u672c\uff0csf-one\u8868\u793a\u547d\u540d\u7a7a\u95f4\uff0c\u6b64\u5185\u5bb9\u4e3a\u5728yaml\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\uff0c\u5982\u679c\u4e0d\u6307\u5b9a\u5c31\u662f\u9ed8\u8ba4\u7684default\u547d\u540d\u7a7a\u95f4<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u67e5\u8be2\u63a7\u5236\u5668deployment\u7684\u540d\u79f0\u4e3agongguan\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>kubectl get deployment -n sf-one<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"728\" height=\"122\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-4.png\" alt=\"\" class=\"wp-image-2650\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-4.png 728w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-4-300x50.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-4-600x101.png 600w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u4e5f\u53ef\u4ee5\u770b\u51fa\uff0c\u6b64\u63a7\u5236\u5668\u76ee\u524d\u7ba1\u7406\u4e86\u4e00\u4e2apod\u5e76\u4e14\u540d\u79f0\u4e3agongguan\uff0c\u4f46\u662f\u76ee\u524d\u53ea\u6709\u4e00\u4e2a\u526f\u672c\u542f\u52a8\uff0c\u53e6\u5916\u4e00\u4e2a\u526f\u672c\u6ca1\u6709\u542f\u52a8\uff0c\u5982\u679c\u8981\u5220\u9664\u6b64Pod\uff0c\u9700\u8981\u5148\u5c06\u63a7\u5236\u5668\u4e2d\u7684pod\u5220\u9664\uff0c\u5426\u5219\u63a7\u5236\u5668\u8fd8\u662f\u4f1a\u6839\u636e\u7b56\u7565\u91cd\u65b0\u521b\u5efaPod <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u5220\u9664\u63a7\u5236\u5668deployment\u4e2d\u7684\u540d\u79f0\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">kubectl delete  deployment gongguan -n sf-one<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"857\" height=\"129\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-7.png\" alt=\"\" class=\"wp-image-2651\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-7.png 857w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-7-300x45.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-7-768x116.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-7-600x90.png 600w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5220\u9664\u4e4b\u540e\uff0c\u518d\u6b21\u6267\u884c\u547d\u4ee4\u67e5\u770bpod\u4fe1\u606f\uff0c\u53d1\u73b0\u6b64Pod \u5df2\u7ecf\u6210\u529f\u5220\u9664\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"125\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-7.png\" alt=\"\" class=\"wp-image-2652\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-7.png 704w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-7-300x53.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-7-600x107.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-n sf-one\u8868\u793a\u6307\u5b9a\u547d\u4ee4\u7a7a\u95f4<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>pod\u6269\u5bb9<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u9996\u5148\u901a\u8fc7\u547d\u4ee4\u67e5\u8be2\u63a7\u5236\u5668deployment\u4e2d\u7684pod\u4fe1\u606f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"739\" height=\"177\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-10.png\" alt=\"\" class=\"wp-image-2675\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-10.png 739w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-10-300x72.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-10-600x144.png 600w\" sizes=\"auto, (max-width: 739px) 100vw, 739px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u540d\u79f0\u4e3aNginx\u7684deploy\u63a7\u5236\u5668\u7ba1\u7406\u7684pod\u526f\u672c\u6570\u91cf\u4e3a2\u4e2a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u4f7f\u7528scale\u547d\u4ee4\uff0c\u5bf9\u5176\u4e2d\u7684pod\u8fdb\u884c\u6269\u5bb9\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"851\" height=\"141\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-8.png\" alt=\"\" class=\"wp-image-2676\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-8.png 851w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-8-300x50.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-8-768x127.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-8-600x99.png 600w\" sizes=\"auto, (max-width: 851px) 100vw, 851px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u518d\u6b21\u6267\u884c\u67e5\u8be2\u547d\u4ee4\uff0c\u53ef\u4ee5\u770b\u5230pod\u526f\u672c\u6570\u91cf\u5df2\u7ecf\u53d8\u6210\u4e863\u4e2a\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"810\" height=\"192\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-4.png\" alt=\"\" class=\"wp-image-2677\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-4.png 810w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-4-300x71.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-4-768x182.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/4-4-600x142.png 600w\" sizes=\"auto, (max-width: 810px) 100vw, 810px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u5982\u679c\u8981\u7f29\u5bb9\uff0c\u90a3\u4e48\u8fd8\u662f\u901a\u8fc7scale\u547d\u4ee4\u8fdb\u884c\uff0c\u4fee\u6539replicas\u7684\u6570\u91cf\u5373\u53ef<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>pod\u66f4\u65b0<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">deployment\u63a7\u5236\u5668\u652f\u6301\u4e24\u79cd\u955c\u50cf\u66f4\u65b0\u7b56\u7565\uff0c\u91cd\u5efa\u66f4\u65b0\u548c\u6eda\u52a8\u66f4\u65b0(\u9ed8\u8ba4)\uff0c\u53ef\u4ee5\u901a\u8fc7strategy\u8fdb\u884c\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>strategy:   \u6307\u5b9a\u65b0\u7684pod\u66ff\u6362\u65e7\u7684pod\u7684\u7b56\u7565\uff0c\u652f\u6301\u4e24\u4e2a\u5c5e\u6027\uff1a\n   type:      \u6307\u5b9a\u7b56\u7565\u7c7b\u578b\uff0c\u652f\u6301\u4e24\u79cd\u7b56\u7565\n     Recreate:\u5728\u521b\u5efa\u65b0Pod\u4e4b\u524d\u5148\u6740\u6389\u5df2\u7ecf\u5b58\u5728\u7684pod  \n     RollingUpdate:\u6eda\u52a8\u66f4\u65b0\uff0c\u6740\u6b7b\u4e00\u90e8\u5206\u5c31\u542f\u52a8\u4e00\u90e8\u5206\uff0c\u66f4\u65b0\u8fc7\u7a0b\u4e2d\u5b58\u5728\u4e24\u4e2a\u7248\u672c\u7684pod\n   rollingUpdate: \u5f53type\u4e3aRollingUpdate\u65f6\u751f\u6548\uff0c\u7528\u4e8e\u4e3aRollingUpdate\u8bbe\u7f6e\u53c2\u6570\uff0c\u652f\u6301\u4e24\u4e2a\u5c5e\u6027\n     maxUnavailable:\u7528\u4e8e\u6307\u5b9a\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u4e0d\u53ef\u7528Pod\u6700\u5927\u6570\u91cf\uff0c\u9ed8\u8ba4\u4e3a25%\n     maxSurage:  \u7528\u6765\u6307\u5b9a\u5728\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u8d85\u8fc7\u671f\u671b\u7684Pod\u7684\u6700\u5927\u6570\u91cf\uff0c\u9ed8\u8ba4\u4e3a25%<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u3001<strong>\u91cd\u5efa\u66f4\u65b0\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u7f16\u8f91pod\u5b9a\u4e49\u6587\u4ef6yaml\uff0c\u5728spec\u4e0b\u6dfb\u52a0\u66f4\u65b0\u7b56\u7565\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"128\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-12.png\" alt=\"\" class=\"wp-image-2680\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-12.png 600w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-12-300x64.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u6267\u884c\u4e0b\u9762\u547d\u4ee4\u53d8\u66f4\u955c\u50cf\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>kubectl set image deployment   pod\u540d\u79f0  \u5bb9\u5668\u540d\u79f0:\u7248\u672c  -n \u547d\u540d\u7a7a\u95f4<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u6267\u884c\u4e0b\u9762\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u66f4\u65b0\u8fc7\u7a0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>kubectl get pod -n \u547d\u540d\u7a7a\u95f4 -w<\/strong><\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u901a\u8fc7set image\u65b9\u5f0f\u66f4\u65b0\u955c\u50cf\u9002\u5408\u4e8e\u672c\u5730\u6709\u955c\u50cf\uff0c\u5982\u679c\u4ece\u4ed3\u5e93\u62c9\u53d6\u90a3\u4e48\u4f1a\u51fa\u73b0\u9519\u8bef<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e8c\u3001<strong>\u6eda\u52a8\u66f4\u65b0(\u9ed8\u8ba4\u5373\u4e3a\u6eda\u52a8\u66f4\u65b0)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u4f8b\u5982\uff1a\u5728nginx.yaml\u4e2d\u672a\u5b9a\u4e49\u66f4\u65b0\u7b56\u7565\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"871\" height=\"566\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-14.png\" alt=\"\" class=\"wp-image-2689\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-14.png 871w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-14-300x195.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-14-768x499.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-14-600x390.png 600w\" sizes=\"auto, (max-width: 871px) 100vw, 871px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>\u7ea0\u6b63\uff1a\u7b2c4\u884c\u4e2d\u7684name\u8868\u793a\u7684\u662fdeployment\u7684\u540d\u79f0\uff0c\u975epod\u540d\u79f0<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u901a\u8fc7<strong>kubectl   describe deployment   nginx<\/strong> \u67e5\u770bpod\u60c5\u51b5\uff0c\u53ef\u4ee5\u770b\u5230\u9ed8\u8ba4\u7684\u66f4\u65b0\u7b56\u7565\u5373\u4e3a\u6eda\u52a8\u66f4\u65b0\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"310\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-12.png\" alt=\"\" class=\"wp-image-2690\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-12.png 733w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-12-300x127.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-12-600x254.png 600w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u901a\u8fc7kubectl   edit   \u547d\u4ee4\u6765\u4fee\u6539deployment\u7684\u914d\u7f6e\uff0c\u5c06 \u5c06spec.template.spec.containers[0].image \u7684\u503c\u8fdb\u884c\u66f4\u6539\u5b9e\u73b0\u66f4\u65b0\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"625\" height=\"180\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-13.png\" alt=\"\" class=\"wp-image-2692\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-13.png 625w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-13-300x86.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-13-600x173.png 600w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u76f4\u63a5\u4fee\u6539\u4e0b\u65b9\u7684\u7248\u672c\u53f7\u5373\u53ef\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"196\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-15.png\" alt=\"\" class=\"wp-image-2693\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-15.png 654w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-15-300x90.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-15-600x180.png 600w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u547d\u4ee4kubectl rollout  status  deployment\/nginx\u53ef\u4ee5\u67e5\u770b\u66f4\u65b0\u8fc7\u7a0b\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"815\" height=\"122\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-10.png\" alt=\"\" class=\"wp-image-2695\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-10.png 815w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-10-300x45.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-10-768x115.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/3-10-600x90.png 600w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u518d\u6b21\u67e5\u770b\u955c\u50cf\u7248\u672c\u60c5\u51b5\uff0c\u53d1\u73b0\u5df2\u7ecf\u66f4\u65b0\u4e86\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"844\" height=\"487\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-16.png\" alt=\"\" class=\"wp-image-2697\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-16.png 844w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-16-300x173.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-16-768x443.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-16-600x346.png 600w\" sizes=\"auto, (max-width: 844px) 100vw, 844px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a Deployment\u7684\u66f4\u65b0\u64cd\u4f5c\u662f\u5728Deployment\u8fdb\u884c\u90e8\u7f72\uff08Rollout\uff09\u65f6\u88ab\u89e6\u53d1\u7684\uff0c\u8fd9\u610f\u5473\u7740\u5f53\u4e14\u4ec5\u5f53Deployment\u7684Pod\u6a21\u677f\uff08\u5373spec.template \uff09\u88ab\u66f4\u6539\u65f6\u624d\u4f1a\u521b\u5efa\u65b0\u7684\u4fee\u8ba2\u7248\u672c\uff0c\u4f8b\u5982\u66f4\u65b0\u6a21\u677f\u6807\u7b7e\u6216\u5bb9\u5668\u955c\u50cf\u3002\u5176\u4ed6\u66f4\u65b0\u64cd\u4f5c\uff08\u5982\u6269\u5c55\u526f\u672c\u6570\uff09\u5c06\u4e0d\u4f1a\u89e6\u53d1Deployment\u7684\u66f4\u65b0\u64cd\u4f5c\uff0c\u8fd9\u4e5f\u610f\u5473\u7740\u6211\u4eec\u5c06Deployment\u56de\u6eda\u5230\u4e4b\u524d\u7684\u7248\u672c\u65f6\uff0c\u53ea\u6709Deployment\u7684Pod\u6a21\u677f\u90e8\u5206\u4f1a\u88ab\u4fee\u6539\u3002 <\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>pod\u56de\u6eda<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u4e0a\u9762\u53d1\u5e03\u7684\u7248\u672c\u8fdb\u884c\u56de\u6eda\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"111\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-14.png\" alt=\"\" class=\"wp-image-2699\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-14.png 786w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-14-300x42.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-14-768x108.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-14-600x85.png 600w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u56de\u6eda\u5230\u6307\u5b9a\u7684\u7248\u672c\uff0c\u4f7f\u7528&#8211;to-revision\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"101\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-17.png\" alt=\"\" class=\"wp-image-2701\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-17.png 962w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-17-300x31.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-17-768x81.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-17-600x63.png 600w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>\u67e5\u770b\u66f4\u65b0\u5386\u53f2<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>kubectl rollout history deployment nginx<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"835\" height=\"140\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-15.png\" alt=\"\" class=\"wp-image-2702\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-15.png 835w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-15-300x50.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-15-768x129.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-15-600x101.png 600w\" sizes=\"auto, (max-width: 835px) 100vw, 835px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">revision\u8868\u793a\u7248\u672c\u53f7\uff0c\u53ef\u4ee5\u770b\u5230CHANGE-CAUSE\u4e3anone\uff0c\u5982\u679c\u5728\u521b\u5efadeployment\u65f6\u6307\u5b9a&#8211;record\u53c2\u6570\uff0c \u5c31\u53ef\u4ee5\u5728CHANGECAUSE\u5217\u770b\u5230\u6bcf\u4e2a\u7248\u672c\u4f7f\u7528\u7684\u547d\u4ee4\u4e86\uff0c\u4f8b\u5982\uff1a<strong>kubectl create -f nginx.yaml  &#8211;record<\/strong><\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1adeployment\/nginx  \u548cdeployment nginx\u76f8\u540c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u67e5\u770b\u7279\u5b9a\u7248\u672c\u7684\u4fe1\u606f\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">kubectl rollout history deployment  nginx &#8211;revision=3<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>pod\u8c03\u5ea6\u7b56\u7565<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7deployment\u521b\u5efa\u5b8cPod\u540e\uff0c\u6b64Pod\u4f1a\u88ab\u968f\u673a\u5206\u914d\u5230\u96c6\u7fa4\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u8282\u70b9(\u5305\u62ecmaster\u8282\u70b9)\uff0c\u6b64\u65f6\u5c5e\u4e8e\u81ea\u52a8\u8c03\u5ea6\u7b56\u7565\uff0c\u5982\u679c\u60f3\u8981pod\u53ea\u5de5\u4f5c\u5728\u6307\u5b9a\u7684\u8282\u70b9\uff0c\u5982\uff1a\u53ea\u5de5\u4f5c\u5728worker\u8282\u70b9\uff0c\u53ef\u4ee5\u901a\u8fc7\u624b\u52a8\u8bbe\u7f6e\u8c03\u5ea6\u7b56\u7565\u7684\u65b9\u5f0f\uff0c\u51e0\u79cd\u7b56\u7565\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u3001 <strong>NodeSelector<\/strong>\uff1a\u5b9a\u5411\u8c03\u5ea6\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u53ef\u4ee5\u901a\u8fc7Node\u7684\u6807\u7b7e\uff08Label\uff09\u548cPod\u7684nodeSelector\u5c5e\u6027\u76f8\u5339\u914d\u6765\u8fbe\u5230\u8c03\u5ea6\u76ee\u7684<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001 \u9996\u5148\u901a\u8fc7kubectl label\u547d\u4ee4\u7ed9\u76ee\u6807Node\u6253\u4e0a\u4e00\u4e9b\u6807\u7b7e\uff1a <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"936\" height=\"189\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-20.png\" alt=\"\" class=\"wp-image-2731\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-20.png 936w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-20-300x61.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-20-768x155.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-20-600x121.png 600w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u56fe\u8868\u793a\u5c06worker1\u8282\u70b9\u548cworker2\u8282\u70b9\u90fd\u6253\u4e0a\u6807\u7b7ezone=one<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u547d\u4ee4kubectl describe nodes \u52a0\u8282\u70b9\u540d\u53ef\u4ee5\u67e5\u770b\u6807\u7b7e\u60c5\u51b5\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"846\" height=\"273\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-18.png\" alt=\"\" class=\"wp-image-2732\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-18.png 846w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-18-300x97.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-18-768x248.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-18-600x194.png 600w\" sizes=\"auto, (max-width: 846px) 100vw, 846px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5728\u8d44\u6e90\u5b9a\u4e49\u6587\u4ef6nginx.yaml\u4e2d\uff0c\u6dfb\u52a0\u8282\u70b9\u6807\u7b7e\u4fe1\u606f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"620\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-21.png\" alt=\"\" class=\"wp-image-2733\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-21.png 877w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-21-300x212.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-21-768x543.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-21-600x424.png 600w\" sizes=\"auto, (max-width: 877px) 100vw, 877px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u7528\u547d\u4ee4kubect create -f nginx.yaml\u521b\u5efaPod\uff0c\u521b\u5efa\u5b8c\u6210\u540e\u901a\u8fc7kubectl get pods -o wide\u67e5\u770bpod\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=\"1024\" height=\"275\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-22-1024x275.png\" alt=\"\" class=\"wp-image-2734\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-22-1024x275.png 1024w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-22-300x81.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-22-768x206.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-22-600x161.png 600w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-22.png 1031w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u56fe\u4e2d\u7684\u5185\u5bb9\u53ef\u4ee5\u770b\u51fa\u6b64pod\u5df2\u7ecf\u8fd0\u884c\u5728\u4e24\u4e2aworker\u8282\u70b9\u4e0a\uff0c\u5f53\u5176\u4e2d\u4e00\u4e2a\u8282\u70b9\u51fa\u73b0\u6545\u969c\u65f6\uff0c\u4e0a\u9762\u7684pod\u4f1a\u88ab\u8c03\u5ea6\u5230\u53e6\u4e00\u4e2a\u8282\u70b9\u4e0a\uff0c\u4ece\u800c\u4fdd\u8bc1\u526f\u672c\u6570\u91cf\u4e0d\u53d8\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e8c\u3001 <strong>NodeAffinity\uff1a<\/strong>Node\u4eb2\u548c\u6027\u8c03\u5ea6\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NodeAffinity\u610f\u4e3aNode\u4eb2\u548c\u6027\u7684\u8c03\u5ea6\u7b56\u7565\uff0c\u662f\u7528\u4e8e\u66ff\u6362NodeSelector\u7684\u5168\u65b0\u8c03\u5ea6\u7b56\u7565\u3002 \u76ee\u524d\u6709\u4e24\u79cd\u8282\u70b9\u4eb2\u548c\u6027\u8868\u8fbe\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001 RequiredDuringSchedulingIgnoredDuringExecution\uff1a\u5fc5\u987b\u6ee1\u8db3\u6307\u5b9a\u7684\u89c4\u5219\u624d\u53ef\u4ee5\u8c03\u5ea6Pod\u5230 Node\u4e0a\uff08\u529f\u80fd\u4e0enodeSelector\u5f88\u50cf\uff0c\u4f46\u662f\u4f7f\u7528\u7684\u662f\u4e0d\u540c\u7684\u8bed\u6cd5\uff09\uff0c<strong>\u76f8\u5f53\u4e8e\u786c\u9650\u5236<\/strong>\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001 PreferredDuringSchedulingIgnoredDuringExecution\uff1a\u5f3a\u8c03\u4f18\u5148\u6ee1\u8db3\u6307\u5b9a\u89c4\u5219\uff0c\u8c03\u5ea6\u5668\u4f1a\u5c1d\u8bd5\u8c03\u5ea6Pod\u5230Node\u4e0a\uff0c\u4f46\u5e76\u4e0d\u5f3a\u6c42\uff0c\u76f8\u5f53\u4e8e\u8f6f\u9650\u5236\u3002\u591a\u4e2a\u4f18\u5148\u7ea7\u89c4\u5219\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u6743\u91cd\uff08weight\uff09\u503c\uff0c\u4ee5\u5b9a\u4e49\u6267\u884c\u7684\u5148\u540e\u987a\u5e8f\u3002<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\"> \u6ce8\u610f\uff1a IgnoredDuringExecution\u7684\u610f\u601d\u662f\uff1a\u5982\u679c\u4e00\u4e2aPod\u6240\u5728\u7684\u8282\u70b9\u5728Pod\u8fd0\u884c\u671f\u95f4\u6807\u7b7e\u53d1\u751f \u4e86\u53d8\u66f4\uff0c\u4e0d\u518d\u7b26\u5408\u8be5Pod\u7684\u8282\u70b9\u4eb2\u548c\u6027\u9700\u6c42\uff0c\u5219\u7cfb\u7edf\u5c06\u5ffd\u7565Node\u4e0aLabel\u7684\u53d8\u5316\uff0c\u8be5Pod\u80fd\u7ee7\u7eed\u5728\u8be5\u8282\u70b9\u8fd0\u884c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> \u4e0b\u9762\u7684\u4f8b\u5b50\u8bbe\u7f6e\u4e86NodeAffinity\u8c03\u5ea6\u7684\u5982\u4e0b\u89c4\u5219\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">requiredDuringSchedulingIgnoredDuringExecution\u8981\u6c42\u53ea\u8fd0\u884c\u5728amd64\u7684\u8282\u70b9\u4e0a\uff08beta.kuber netes.io\/arch In amd64\uff09 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> preferredDuringSchedulingIgnoredDuringExecution\u7684\u8981\u6c42\u662f\u5c3d\u91cf\u8fd0\u884c\u5728\u78c1\u76d8\u7c7b\u578b\u4e3assd\uff08disk -type In ssd\uff09\u7684\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=\"663\" height=\"623\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/12-1.png\" alt=\"\" class=\"wp-image-2739\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/12-1.png 663w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/12-1-300x282.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/12-1-600x564.png 600w\" sizes=\"auto, (max-width: 663px) 100vw, 663px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e0a\u9762\u7684\u914d\u7f6e\u4e2d\u53ef\u4ee5\u770b\u5230In\u64cd\u4f5c\u7b26\uff0cNodeAffinity\u8bed\u6cd5\u652f\u6301\u7684\u64cd\u4f5c\u7b26\u5305\u62ecIn\u3001NotIn\u3001Exists\u3001DoesNotExist\u3001Gt\u3001Lt\u3002\u867d\u7136\u6ca1\u6709\u8282\u70b9\u6392\u65a5\u529f\u80fd\uff0c\u4f46\u662f\u7528NotIn\u548cDoesNotExist\u5c31\u53ef\u4ee5\u5b9e\u73b0\u6392\u65a5\u7684\u529f\u80fd\u4e86\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> NodeAffinity\u89c4\u5219\u8bbe\u7f6e\u7684\u6ce8\u610f\u4e8b\u9879\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li> \u5982\u679c\u540c\u65f6\u5b9a\u4e49\u4e86nodeSelector\u548cnodeAffinity\uff0c\u90a3\u4e48\u5fc5\u987b\u4e24\u4e2a\u6761\u4ef6\u90fd\u5f97\u5230\u6ee1\u8db3\uff0cPod\u624d\u80fd\u6700\u7ec8\u8fd0\u884c\u5728\u6307\u5b9a\u7684Node\u4e0a\u3002 <\/li><li> \u5982\u679cnodeAffinity\u6307\u5b9a\u4e86\u591a\u4e2anodeSelectorTerms\uff0c\u90a3\u4e48\u5176\u4e2d\u4e00\u4e2a\u80fd\u591f\u5339\u914d\u6210\u529f\u5373\u53ef\u3002 <\/li><li> \u5982\u679c\u5728nodeSelectorTerms\u4e2d\u6709\u591a\u4e2amatchExpressions\uff0c\u5219\u4e00\u4e2a\u8282\u70b9\u5fc5\u987b\u6ee1\u8db3\u6240\u6709matchExpre ssions\u624d\u80fd\u8fd0\u884c\u8be5Pod\u3002 <\/li><\/ol>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"> <strong>\u6682\u505c\u548c\u6062\u590dDeployment \u7684\u90e8\u7f72\u64cd\u4f5c\uff0c\u4ee5\u5b8c\u6210\u590d\u6742\u7684\u4fee\u6539 <\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7531\u4e8e\u6bcf\u4e00\u6b21\u4fee\u6539deployment\u4e4b\u540e\u90fd\u4f1a\u91cd\u65b0\u89e6\u53d1\u66f4\u65b0\uff0c \u4e3a\u4e86\u907f\u514d\u9891\u7e41\u89e6\u53d1Deployment\u7684\u66f4\u65b0\u64cd\u4f5c\uff0c \u53ef\u4ee5\u5148\u6682\u505cDeployment\u7684\u66f4\u65b0\u64cd\u4f5c\uff0c\u7136\u540e\u8fdb\u884c\u914d\u7f6e\u4fee\u6539\uff0c\u518d\u6062\u590dDeployment\uff0c\u4e00\u6b21\u6027\u89e6\u53d1\u5b8c\u6574\u7684\u66f4\u65b0\u64cd\u4f5c\uff0c\u5c31\u53ef\u4ee5\u907f\u514d\u4e0d\u5fc5\u8981\u7684Deployment\u66f4\u65b0\u64cd\u4f5c\u4e86\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff1a\u8fd8\u662f\u7528\u4e4b\u524d\u521b\u5efa\u7684nginx\u4e3a\u4f8b\u5b50\uff0c\u5148\u6682\u505c\u6b64pod\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"151\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-23.png\" alt=\"\" class=\"wp-image-2745\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-23.png 789w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-23-300x57.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-23-768x147.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-23-600x115.png 600w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u901a\u8fc7kubectl set image\u6216\u8005kubectl edit deployment nginx\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u4f8b\u5982\u7248\u672c\u66f4\u65b0\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"121\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-24.png\" alt=\"\" class=\"wp-image-2746\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-24.png 688w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-24-300x53.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-24-600x106.png 600w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"> \u67e5\u770bDeployment\u7684\u5386\u53f2\u8bb0\u5f55\uff0c\u53d1\u73b0\u5e76\u6ca1\u6709\u89e6\u53d1\u65b0\u7684Deployment\u90e8\u7f72\u64cd\u4f5c\uff1a <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"809\" height=\"137\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-25.png\" alt=\"\" class=\"wp-image-2747\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-25.png 809w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-25-300x51.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-25-768x130.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-25-600x102.png 600w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"> \u6700\u540e\uff0c\u6062\u590d\u8fd9\u4e2aDeployment\u7684\u90e8\u7f72\u64cd\u4f5c\uff1a <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"807\" height=\"110\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-19.png\" alt=\"\" class=\"wp-image-2748\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-19.png 807w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-19-300x41.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-19-768x105.png 768w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/2-19-600x82.png 600w\" sizes=\"auto, (max-width: 807px) 100vw, 807px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fdb\u884c\u9a8c\u8bc1\uff0c\u53d1\u73b0\u7248\u672c\u5df2\u7ecf\u5347\u7ea7\u6210\u529f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7<strong>kubectl describe  deployment nginx<\/strong>\u53ef\u4ee5\u770b\u5230\u5347\u7ea7\u8fc7\u7a0b\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"198\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-26.png\" alt=\"\" class=\"wp-image-2750\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-26.png 673w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-26-300x88.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/12\/1-26-600x177.png 600w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>Pod\u5bb9\u5668\u5171\u4eabVolume<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u540c\u4e00\u4e2aPod\u4e2d\u7684\u591a\u4e2a\u5bb9\u5668\u80fd\u591f\u5171\u4eabPod\u7ea7\u522b\u7684\u5b58\u50a8\u5377Volume\u3002Volume\u53ef\u4ee5\u88ab\u5b9a\u4e49\u4e3a\u5404\u79cd\u7c7b\u578b\uff0c\u591a\u4e2a\u5bb9\u5668\u5404\u81ea\u8fdb\u884c\u6302\u8f7d\u64cd\u4f5c\uff0c\u5c06\u4e00\u4e2aVolume\u6302\u8f7d\u4e3a\u5bb9\u5668\u5185\u90e8\u9700\u8981\u7684\u76ee\u5f55\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"701\" height=\"361\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/8.png\" alt=\"\" class=\"wp-image-6195\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/8.png 701w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/8-300x154.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/8-600x309.png 600w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u4e0b\u9762\u7684yaml\u6587\u4ef6\u4e2d\u5305\u542b\u4e24\u4e2a\u5bb9\u5668\uff0ctomcat\u548cbusybox\uff0c\u5728Pod\u7ea7\u522b\u8bbe\u7f6eVolume\u201capp-logs\u201d\uff0c\u7528\u4e8etomcat\u5bb9\u5668\u5411\u5176\u4e2d\u5199\u65e5\u5fd7\u6587\u4ef6\uff0cbusybox\u5bb9\u5668\u4ece\u4e2d\u8bfb\u65e5\u5fd7\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Pod\nmetadata:\n  name: tomcat-busybox\nspec:\n  containers:\n  - name: tomcat\n    image: tomcat\n    imagePullPolicy: IfNotPresent\n    ports:\n    - containerPort: 8080\n    volumeMounts:\n    - name: app-logs\n      mountPath: \/usr\/local\/tomcat\/logs\n  - name: busybox\n    image: busybox\n    imagePullPolicy: IfNotPresent\n    command: &#91;\"sh\",\"-c\",\"tail -f \/logs\/catalina*.log\"]\n    volumeMounts:\n    - name: app-logs\n      mountPath: \/logs\n  volumes:\n  - name: app-logs\n    emptyDir: {}\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"378\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/13.png\" alt=\"\" class=\"wp-image-6196\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/13.png 705w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/13-300x161.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/13-600x322.png 600w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf4\u660e\uff1a\u8bbe\u7f6e\u7684Volume\u540d\u79f0\u4e3aapp-logs\uff0c\u7c7b\u578b\u4e3aemptyDir(\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u5176\u4ed6\u7c7b\u578b)\uff0c\u6302\u8f7d\u5230tomcat\u5bb9\u5668\u5185\u7684\/usr\/local\/tomcat\/logs\u76ee\u5f55\u4e0b\uff0c\u540c\u65f6\u6302\u8f7d\u5230busybox\u5bb9\u5668\u5185\u7684\/logs\u76ee\u5f55\uff0ctomcat \u5bb9 \u5668 \u5728 \u542f \u52a8 \u540e \u4f1a \u5411 \/usr\/local\/tomcat\/logs \u76ee \u5f55 \u5199 \u6587 \u4ef6\uff0cbusybox\u5bb9\u5668\u5c31\u53ef\u4ee5\u8bfb\u53d6\u5176\u4e2d\u7684\u6587\u4ef6\u4e86<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u521b\u5efapod\uff0ckubectl apply -f tomcat-busybox.yaml\uff0c\u7136\u540e\u6267\u884c\u547d\u4ee4\u67e5\u770b\u65e5\u5fd7\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"703\" height=\"269\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/12.png\" alt=\"\" class=\"wp-image-6197\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/12.png 703w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/12-300x115.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/12-600x230.png 600w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6267\u884c\u547d\u4ee4\u8fdb\u5165\u5bb9\u5668\u5185\u90e8\u4e5f\u53ef\u4ee5\u770b\u5230\u65e5\u5fd7\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl exec -it tomcat-busybox -c tomcat -- tail -n 50 \/usr\/local\/tomcat\/logs\/catalina.2022-01-05.log\n#-c tomcat\u8868\u793a\u6307\u5b9apod\u5185\u7684tomcat\u5bb9\u5668\uff0c\u56e0\u6b64pod\u91cc\u6709\u4e24\u4e2a\u5bb9\u5668<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u7684\u521b\u5efa\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u7528\u6237\u901a\u8fc7kubectl\u6216\u8005\u5176\u4ed6\u7684API\u5ba2\u6237\u7aef\u63d0\u4ea4PodSpec\u7ed9API Server<\/li><li>API Server \u5c06pod\u7684\u4fe1\u606f\u5b58\u5165\u5230etcd\u4e2d\uff0c\u5e76\u8fd4\u56de\u786e\u8ba4\u4fe1\u606f\u7ed9\u5ba2\u6237\u7aef<\/li><li>Schedule(\u8c03\u5ea6\u5668) \u901a\u8fc7\u5176wardher\u76d1\u6d4b\u5230API Server\u521b\u5efa\u4e86\u65b0\u7684Pod\u5bf9\u8c61\uff0c\u4e3a\u8be5Pod\u5bf9\u8c61\u6311\u9009\u4e00\u4e2a\u5de5\u4f5c\u8282\u70b9\uff0c\u5e76\u5c06\u7ed3\u679c\u4fe1\u606f\u66f4\u65b0\u81f3API Server<\/li><li>\u8c03\u5ea6\u7ed3\u679c\u7531API Server\u66f4\u65b0\u81f3etcd\u5b58\u50a8\u7cfb\u7edf\uff0c\u5e76\u540c\u6b65\u7ed9Schedule<\/li><li>\u76f8\u5e94\u8282\u70b9\u7684kubelet\u76d1\u6d4b\u5230\u7531\u8c03\u5ea6\u5668\u7ed1\u5b9a\u5230\u672c\u8282\u70b9\u7684pod\u540e\u4f1a\u8bfb\u53d6\u5176\u914d\u7f6e\u4fe1\u606f\uff0c\u5e76\u7531\u672c\u5730\u5bb9\u5668\u8fd0\u884c\u65f6\u521b\u5efa\u76f8\u5e94\u7684\u5bb9\u5668\uff0c\u542f\u52a8pod\u540e\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9API Server<\/li><li>API Server\u5c06kubelet\u53d1\u6765\u7684pod\u72b6\u6001\u4fe1\u606f\u5b58\u5165etcd\u7cfb\u7edf\u4e2d\uff0c\u5e76\u5c06\u786e\u8ba4\u4fe1\u606f\u53d1\u7ed9kubelet<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u7684\u5220\u9664\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u7528\u6237\u53d1\u9001\u5220\u9664Pod\u7684\u547d\u4ee4<\/li><li>API \u670d\u52a1\u5668\u4e2d\u7684Pod\u5bf9\u8c61\u968f\u7740\u65f6\u95f4\u63a8\u79fb\u800c\u66f4\u65b0\uff0c\u5728\u5bbd\u9650\u671f(\u9ed8\u8ba430s)\u5185\uff0cPod\u88ab\u89c6\u4e3adead<\/li><li>\u5c06Pod\u6807\u8bb0\u4e3aTerminating\u72b6\u6001<\/li><li>kubelet\u540c\u65f6\u76d1\u6d4b\u5230pod\u8f6c\u53d8\u4e3aTermination\u540e\uff0c\u540c\u65f6\u542f\u52a8Pod\u5173\u95ed\u8fc7\u7a0b<\/li><li>\u7aef\u70b9\u63a7\u5236\u5668\u540c\u65f6\u76d1\u63a7\u5230Pod\u5bf9\u8c61\u7684\u5173\u95ed\u884c\u4e3a\uff0c\u5c06\u5176\u4ece\u6240\u6709\u5339\u914d\u5230\u6b64\u7aef\u70b9\u7684service\u8d44\u6e90\u4ece\u7aef\u70b9\u5217\u8868\u79fb\u9664<\/li><li>\u5982\u679c\u5f53\u524d\u7684Pod\u5bf9\u8c61\u5b9a\u4e49\u4e86preStop\u94a9\u5b50\u53e5\u67c4\uff0c\u5728\u5176\u6807\u8bb0\u4e3aterminating\u540e\u4f1a\u4ee5\u540c\u6b65\u65b9\u5f0f\u542f\u52a8\u6267\u884c\uff0c\u82e5\u5bbd\u9650\u671f\u7ed3\u675f\u540e\uff0cpreStop\u4ecd\u672a\u6267\u884c\u5b8c\uff0c\u5219\u91cd\u65b0\u6267\u884c\u7b2c\u4e8c\u6b65\uff0c\u5e76\u83b7\u53d6\u4e00\u4e2a\u65f6\u957f\u4e3a2s\u7684\u5bbd\u9650\u671f<\/li><li>pod\u5bf9\u8c61\u4e2d\u7684\u5bb9\u5668\u6536\u5230TERM\u4fe1\u53f7(\u4ee5\u6b63\u5e38\u65b9\u5f0f\u4e2d\u6b62\u5bb9\u5668)<\/li><li>\u5bbd\u9650\u671f\u7ed3\u675f\u540e\uff0c\u5982\u679c\u8fd8\u5b58\u5728\u4e00\u4e2a\u8fd0\u884c\u7684\u8fdb\u7a0b\uff0c\u6b64\u65f6Pod\u5bf9\u8c61\u4f1a\u6536\u5230SIGKILL\u4fe1\u53f7(\u5f3a\u5236\u4e2d\u65ad)<\/li><li>kubelet\u8bf7\u6c42API Server\u5c06\u5176pod\u7684\u5bbd\u9650\u671f\u8bbe\u7f6e\u4e3a0\uff0c\u4ece\u800c\u5220\u9664\u64cd\u4f5c\uff0c\u540c\u65f6\u5bf9\u7528\u6237\u4e0d\u53ef\u89c1<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a Pod \u4e2d\u7684\u5e94\u7528\u5bb9\u5668\u5171\u4eab\u4e94\u79cd\u8d44\u6e90\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>PID \u547d\u540d\u7a7a\u95f4\uff1aPod \u4e2d\u7684\u4e0d\u540c\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u770b\u5230\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u7684\u8fdb\u7a0b ID<\/li><li>network\u547d\u540d\u7a7a\u95f4\uff1aPod \u4e2d\u7684\u591a\u4e2a\u5bb9\u5668\u80fd\u591f\u8bbf\u95ee\u540c\u4e00\u4e2aIP\u548c\u7aef\u53e3\u8303\u56f4<\/li><li>IPC \u547d\u540d\u7a7a\u95f4\uff1aPod \u4e2d\u7684\u591a\u4e2a\u5bb9\u5668\u80fd\u591f\u4f7f\u7528 SystemV IPC \u6216 POSIX \u6d88\u606f\u961f\u5217\u8fdb\u884c\u901a\u4fe1<\/li><li>UTS \u547d\u540d\u7a7a\u95f4\uff1aPod \u4e2d\u7684\u591a\u4e2a\u5bb9\u5668\u5171\u4eab\u4e00\u4e2a\u4e3b\u673a\u540d(uts: linux\u7684\u547d\u540d\u7a7a\u95f4\u5b50\u7cfb\u7edf\uff0c\u4e3b\u8981\u7528\u6765\u5b8c\u6210\u5bf9\u5bb9\u5668HOSTNAME\u548cdomain\u7684\u9694\u79bb\uff0c\u4f7f\u5f97\u7528\u6237\u5728\u5bb9\u5668\u4e2d\u67e5\u770b\u5230\u7684\u4fe1\u606f\u662f\u5f53\u524d\u5bb9\u5668\u7684\u7cfb\u7edf\u3001\u7248\u672c\uff0c\u4e0d\u540c\u4e8e\u4e3b\u673a)<\/li><li>Volumes\uff08\u5171\u4eab\u5b58\u50a8\u5377\uff09\uff1aPod \u4e2d\u7684\u5404\u4e2a\u5bb9\u5668\u53ef\u4ee5\u8bbf\u95ee\u5728 Pod \u7ea7\u522b\u5b9a\u4e49\u7684 Volumes<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u521b\u5efa\u5b8cpod\u540e\uff0c \u5982\u679c\u4e0d\u6307\u5b9a\u547d\u540d\u7a7a\u95f4\uff0c\u9ed8\u8ba4\u90fd\u662f\u521b\u5efa\u5230default\u7684\u547d\u4ee4\u7a7a\u95f4\uff0c\u53ef\u4ee5\u901a\u8fc7dashborad\u4e2d\u7684n [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2705,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,23],"tags":[],"class_list":["post-2642","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kubernetes","category-rong"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2642","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=2642"}],"version-history":[{"count":46,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2642\/revisions"}],"predecessor-version":[{"id":10943,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2642\/revisions\/10943"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/2705"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}