{"id":4948,"date":"2021-10-01T17:16:12","date_gmt":"2021-10-01T09:16:12","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=4948"},"modified":"2025-12-29T14:49:05","modified_gmt":"2025-12-29T06:49:05","slug":"pod-3","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2021\/10\/01\/pod-3\/","title":{"rendered":"Pod\u751f\u547d\u5468\u671f\u548c\u5065\u5eb7\u68c0\u67e5"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e00\u3001Pod\u751f\u547d\u5468\u671f\u548c\u91cd\u542f\u7b56\u7565\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u5728\u6574\u4e2a\u751f\u547d\u5468\u671f\u4e2d\u88ab\u7cfb\u7edf\u5b9a\u4e49\u4e3a\u5404\u79cd\u72b6\u6001\uff0c\u719f\u6089Pod\u7684\u5404\u79cd\u72b6\u6001 \u5bf9\u4e8e\u7406\u89e3\u5982\u4f55\u8bbe\u7f6ePod\u7684\u8c03\u5ea6\u7b56\u7565\u3001\u91cd\u542f\u7b56\u7565\u662f\u5f88\u6709\u5fc5\u8981\u7684<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u7684\u51e0\u79cd\u72b6\u6001\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">\u72b6\u6001\u503c<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u63cf\u8ff0<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Pending<\/td><td class=\"has-text-align-center\" data-align=\"center\">Apiserver\u5df2\u7ecf\u521b\u5efa\u8be5Pod\uff0c\u4f46\u662fpod\u5185\u8fd8\u8981\u4e00\u4e2a\u6216\u591a\u4e2a\u5bb9\u5668\u955c\u50cf\u6ca1\u6709\u521b\u5efa\uff0c\u5305\u62ec\u6b63\u5728\u4e0b\u8f7d\u955c\u50cf\u7684\u8fc7\u7a0b<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Running<\/td><td class=\"has-text-align-center\" data-align=\"center\">Pod\u6240\u6709\u5bb9\u5668\u5df2\u521b\u5efa\uff0c\u4e14\u81f3\u5c11\u6709\u4e00\u4e2a\u5bb9\u5668\u5904\u4e8e\u8fd0\u884c\u72b6\u6001\u3001\u6b63\u5728\u542f\u52a8\u72b6\u6001\u6216\u6b63\u5728\u91cd\u542f\u72b6\u6001<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Succeeded<\/td><td class=\"has-text-align-center\" data-align=\"center\">Pod\u5185\u6240\u6709\u5bb9\u5668\u5747\u6210\u529f\u6267\u884c\u540e\u9000\u51fa\uff0c\u4e14\u4e0d\u4f1a\u518d\u91cd\u542f<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Failed<\/td><td class=\"has-text-align-center\" data-align=\"center\">Pod\u5185\u5bb9\u5668\u5747\u5df2\u6210\u529f\u9000\u51fa\uff0c\u4f46\u81f3\u5c11\u6709\u4e00\u4e2a\u5bb9\u5668\u9000\u51fa\u4e3a\u5931\u8d25\u72b6\u6001<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Unknown<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u7531\u4e8e\u67d0\u79cd\u539f\u56e0\u65e0\u6cd5\u83b7\u53d6pod\u72b6\u6001\uff0c\u53ef\u80fd\u662f\u7f51\u7edc\u4e0d\u901a<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Blocked<\/td><td class=\"has-text-align-center\" data-align=\"center\">Pod\u5904\u4e8e\u963b\u585e\u72b6\u6001\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\uff0c\u8d44\u6e90\u4e0d\u8db3\u6216\u65e0\u6cd5\u8bbf\u95ee\uff0c\u6216Pod\u7684\u8c03\u5ea6\u53ef\u80fd\u9047\u5230\u4e86\u95ee\u9898<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u7684\u91cd\u542f\u7b56\u7565\uff08RestartPolicy\uff09\u5e94\u7528\u4e8ePod\u5185\u7684\u6240\u6709\u5bb9\u5668\uff0c\u5e76\u4e14\u4ec5\u5728Pod\u6240\u5904\u7684Node\u4e0a\u7531kubelet\u8fdb\u884c\u5224\u65ad\u548c\u91cd\u542f\u64cd\u4f5c\u3002\u5f53\u67d0\u4e2a\u5bb9\u5668\u5f02\u5e38\u9000\u51fa\u6216\u8005\u5065\u5eb7\u68c0\u67e5\uff08\u8be6\u89c1\u4e0b\u8282\uff09\u5931\u8d25\u65f6\uff0ckubelet\u5c06\u6839\u636eRestartPolicy\u7684\u8bbe\u7f6e\u6765\u8fdb\u884c\u76f8\u5e94\u7684\u64cd\u4f5c\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u7684\u91cd\u542f\u7b56\u7565\u5305\u62ecAlways\u3001OnFailure\u548cNever\uff0c\u9ed8\u8ba4\u503c\u4e3aAlways\uff0c\u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li> Always\uff1a\u5f53\u5bb9\u5668\u5931\u6548\u65f6\uff0c\u7531kubelet\u81ea\u52a8\u91cd\u542f\u8be5\u5bb9\u5668\u3002 <\/li>\n\n\n\n<li> OnFailure\uff1a\u5f53\u5bb9\u5668\u7ec8\u6b62\u8fd0\u884c\u4e14\u9000\u51fa\u7801\u4e0d\u4e3a0\u65f6\uff0c\u7531kubelet\u81ea\u52a8\u91cd\u542f\u8be5\u5bb9\u5668\u3002 <\/li>\n\n\n\n<li> Never\uff1a\u4e0d\u8bba\u5bb9\u5668\u8fd0\u884c\u72b6\u6001\u5982\u4f55\uff0ckubelet\u90fd\u4e0d\u4f1a\u91cd\u542f\u8be5\u5bb9\u5668 <\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">kubelet\u91cd\u542f\u5931\u6548\u5bb9\u5668\u7684\u65f6\u95f4\u95f4\u9694\u4ee5sync-frequency\u4e58\u4ee52n\u6765\u8ba1\u7b97\uff0c\u4f8b \u59821\u30012\u30014\u30018\u500d\u7b49\uff0c\u6700\u957f\u5ef6\u65f65min\uff0c\u5e76\u4e14\u5728\u6210\u529f\u91cd\u542f\u540e\u768410min\u540e\u91cd\u7f6e\u8be5\u65f6\u95f4<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u7684\u91cd\u542f\u7b56\u7565\u4e0e\u63a7\u5236\u65b9\u5f0f\u606f\u606f\u76f8\u5173\uff0c\u5f53\u524d\u53ef\u7528\u4e8e\u7ba1\u7406Pod\u7684\u63a7\u5236\u5668 \u5305\u62ecReplicationController\u3001Job\u3001DaemonSet\u53ca\u76f4\u63a5\u901a\u8fc7kubelet\u7ba1\u7406\uff08\u9759 \u6001Pod\uff09\u3002\u6bcf\u79cd\u63a7\u5236\u5668\u5bf9Pod\u7684\u91cd\u542f\u7b56\u7565\u8981\u6c42\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li> RC\u548cDaemonSet\uff1a\u5fc5\u987b\u8bbe\u7f6e\u4e3aAlways\uff0c\u9700\u8981\u4fdd\u8bc1\u8be5\u5bb9\u5668\u6301\u7eed\u8fd0\u884c\u3002 <\/li>\n\n\n\n<li> Job\uff1aOnFailure\u6216Never\uff0c\u786e\u4fdd\u5bb9\u5668\u6267\u884c\u5b8c\u6210\u540e\u4e0d\u518d\u91cd\u542f <\/li>\n\n\n\n<li> kubelet\uff1a\u5728Pod\u5931\u6548\u65f6\u81ea\u52a8\u91cd\u542f\u5b83\uff0c\u4e0d\u8bba\u5c06RestartPolicy\u8bbe\u7f6e\u4e3a\u4ec0\u4e48\u503c\uff0c\u4e5f\u4e0d\u4f1a\u5bf9Pod\u8fdb\u884c\u5065\u5eb7\u68c0\u67e5(\u9759\u6001pod)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5e38\u89c1\u7684pod\u8f6c\u6362\u573a\u666f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><td class=\"has-text-align-center\" data-align=\"center\">pod\u72b6\u6001<\/td><td class=\"has-text-align-center\" data-align=\"center\"> pod\u72b6\u6001 <\/td><td class=\"has-text-align-center\" data-align=\"center\"> pod\u72b6\u6001 <\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Pod\u5305\u542b\u5bb9\u5668\u6570<\/td><td class=\"has-text-align-center\" data-align=\"center\">Pod\u5f53\u524d\u72b6\u6001<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u53d1\u751f\u4e8b\u4ef6<\/td><td class=\"has-text-align-center\" data-align=\"center\">Always<\/td><td class=\"has-text-align-center\" data-align=\"center\">OnFailure<\/td><td class=\"has-text-align-center\" data-align=\"center\">Never<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\u5305\u542b1\u4e2a\u5bb9\u5668<\/td><td class=\"has-text-align-center\" data-align=\"center\">Running<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u5bb9\u5668\u9000\u51fa\u6210\u529f<\/td><td class=\"has-text-align-center\" data-align=\"center\">Running<\/td><td class=\"has-text-align-center\" data-align=\"center\">Succeeded<\/td><td class=\"has-text-align-center\" data-align=\"center\"> Succeeded <\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"> \u5305\u542b1\u4e2a\u5bb9\u5668 <\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running <\/td><td class=\"has-text-align-center\" data-align=\"center\"> \u5bb9\u5668\u9000\u51fa\u5931\u8d25<\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running <\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running <\/td><td class=\"has-text-align-center\" data-align=\"center\">Failed<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">  \u5305\u542b2\u4e2a\u5bb9\u5668  <\/td><td class=\"has-text-align-center\" data-align=\"center\">  Running  <\/td><td class=\"has-text-align-center\" data-align=\"center\">1\u4e2a\u5bb9\u5668\u9000\u51fa\u5931\u8d25<\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running  <\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running  <\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running  <\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"> \u5305\u542b2\u4e2a\u5bb9\u5668 <\/td><td class=\"has-text-align-center\" data-align=\"center\">  Running  <\/td><td class=\"has-text-align-center\" data-align=\"center\">\u5bb9\u5668\u88aboom\u6740\u6389<\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running   <\/td><td class=\"has-text-align-center\" data-align=\"center\"> Running   <\/td><td class=\"has-text-align-center\" data-align=\"center\"> Failed <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Pod\u53ef\u80fd\u91cd\u542f\u7684\u573a\u666f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>pod\u7684infrastructure\u5bb9\u5668(pause) \u66f4\u65b0\uff0c\u6b64\u65f6pod\u4f1a\u91cd\u542f<\/li>\n\n\n\n<li>pod\u6240\u6709\u5e94\u7528\u5bb9\u5668\u90fd\u7ec8\u6b62\uff0c\u5e76\u4e14\u91cd\u542f\u7b56\u7565\u4e3aalways\uff0c\u6b64\u65f6Pod\u4f1a\u91cd\u542f<\/li>\n\n\n\n<li>\u5728k8s 1.20\u7248\u672c\u4e4b\u524d\uff0c\u521d\u59cb\u5316\u5bb9\u5668\u7684\u955c\u50cf\u66f4\u65b0\uff0c\u5bb9\u5668\u91cd\u65b0\u8fd0\u884c\uff0cpod\u4f1a\u91cd\u542f\uff0c1.20\u540e\u4e0d\u4f1a\u91cd\u542f<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>\u4e8c\u3001Pod\u5065\u5eb7\u68c0\u67e5\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Kubernetes \u5bf9 Pod \u7684\u5065\u5eb7\u72b6\u6001\u53ef\u4ee5\u901a\u8fc7\u4e09\u7c7b\u63a2\u9488\u6765\u68c0\u67e5\uff1a <strong>LivenessProbe<\/strong> \u548c<strong>ReadinessProbe<\/strong>\u4ee5\u53caStartupProbe\uff0c\u5176\u4e2d\u6700\u4e3b\u8981\u7684\u63a2\u9488\u662f <strong>LivenessProbe<\/strong> \u548c<strong>ReadinessProbe<\/strong> \uff0ckubelet\u5b9a\u671f\u6267\u884c\u8fd9\u4e24\u7c7b\u63a2\u9488\u6765\u8bca\u65ad\u5bb9\u5668\u7684\u5065\u5eb7\u72b6\u51b5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001 <strong>LivenessProbe<\/strong>\u63a2\u9488\uff1a\u7528\u4e8e\u5224\u65ad\u5bb9\u5668\u662f\u5426\u5b58\u6d3b\uff08Running\u72b6 \u6001\uff09\uff0c\u5982\u679cLivenessProbe\u63a2\u9488\u63a2\u6d4b\u5230\u5bb9\u5668\u4e0d\u5065\u5eb7\uff0c\u5219kubelet\u5c06\u6740\u6389\u8be5\u5bb9\u5668\uff0c\u5e76\u6839\u636e\u5bb9\u5668\u7684\u91cd\u542f\u7b56\u7565\u505a\u76f8\u5e94\u7684\u5904\u7406\u3002\u5982\u679c\u4e00\u4e2a\u5bb9\u5668\u4e0d\u5305\u542b LivenessProbe\u63a2\u9488\uff0c\u90a3\u4e48kubelet\u8ba4\u4e3a\u8be5\u5bb9\u5668\u7684LivenessProbe\u63a2\u9488\u8fd4\u56de\u7684\u503c\u6c38\u8fdc\u662fSuccess\u3002  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001 ReadinessProbe\u63a2\u9488\uff1a\u7528\u4e8e\u5224\u65ad\u5bb9\u5668\u670d\u52a1\u662f\u5426\u53ef\u7528\uff08Ready\u72b6 \u6001\uff09\uff0c\u8fbe\u5230Ready\u72b6\u6001\u7684Pod\u624d\u53ef\u4ee5\u63a5\u6536\u8bf7\u6c42\u3002\u5bf9\u4e8e\u88abService\u7ba1\u7406\u7684 Pod\uff0cService\u4e0ePod Endpoint\u7684\u5173\u8054\u5173\u7cfb\u4e5f\u5c06\u57fa\u4e8ePod\u662f\u5426Ready\u8fdb\u884c\u8bbe\u7f6e\u3002\u5982\u679c\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2dReady\u72b6\u6001\u53d8\u4e3aFalse\uff0c\u5219\u7cfb\u7edf\u81ea\u52a8\u5c06\u5176\u4eceService \u7684\u540e\u7aefEndpoint\u5217\u8868\u4e2d\u9694\u79bb\u51fa\u53bb\uff0c\u540e\u7eed\u518d\u628a\u6062\u590d\u5230Ready\u72b6\u6001\u7684Pod\u52a0\u56de\u540e\u7aefEndpoint\u5217\u8868\u3002\u8fd9\u6837\u5c31\u80fd\u4fdd\u8bc1\u5ba2\u6237\u7aef\u5728\u8bbf\u95eeService\u65f6\u4e0d\u4f1a\u88ab\u8f6c\u53d1\u5230\u670d\u52a1\u4e0d\u53ef\u7528\u7684Pod\u5b9e\u4f8b\u4e0a\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001StartupProbe\u63a2\u9488\uff1a\u67d0\u4e9b\u5e94\u7528\u4f1a\u9047\u5230\u542f\u52a8\u6bd4\u8f83\u6162\u7684\u60c5\u51b5\uff0c\u4f8b\u5982\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u9700\u8981\u4e0e\u8fdc\u7a0b\u670d\u52a1\u5668\u5efa\u7acb\u7f51\u7edc\u8fde\u63a5\uff0c\u6216\u8005\u9047\u5230\u7f51\u7edc\u8bbf\u95ee\u8f83\u6162\u7b49\u60c5\u51b5\u65f6\uff0c\u4f1a\u9020\u6210\u5bb9\u5668\u542f\u52a8\u7f13\u6162\uff0c\u6b64\u65f6ReadinessProbe\u5c31\u4e0d\u9002\u7528\u4e86\uff0c\u56e0\u4e3a\u8fd9\u5c5e\u4e8e\u201c\u6709\u4e14\u4ec5\u6709\u4e00\u6b21\u201d\u7684\u8d85\u957f\u5ef6\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7StartupProbe\u63a2\u9488\u89e3\u51b3\u8be5\u95ee\u9898\u3002<\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\uff1a\u4e09\u79cd\u68c0\u67e5\u65b9\u5f0f\u540c\u65f6\u53ea\u80fd\u4f7f\u7528\u4e00\u79cd<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u63a2\u9488\u5747\u53ef\u914d\u7f6e\u4ee5\u4e0b\u4e09\u79cd\u5b9e\u73b0\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3001ExecAction\uff1a<\/strong>\u5728\u5bb9\u5668\u5185\u90e8\u8fd0\u884c\u4e00\u4e2a\u547d\u4ee4\uff0c\u5982\u679c\u8be5\u547d\u4ee4\u7684\u8fd4\u56de\u7801\u4e3a0\uff0c\u5219\u8868\u660e\u5bb9\u5668\u5065\u5eb7\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762pod\u4e2d\uff0c\u5728\u5bb9\u5668\u751f\u547d\u5468\u671f\u7684\u6700\u521d60s\u5185\uff0c\u4f1a\u521b\u5efa\u4e00\u4e2ahealthy\u6587\u4ef6\uff0c\u56e0\u6b64\u8fd960s\u5185\u6267\u884ccat\u4f1a\u8fd4\u56de\u4e00\u4e2a\u6210\u529f\u7684\u72b6\u6001\u7801\uff0c60s\u540e\uff0c\u6587\u4ef6\u5c06\u5220\u9664\uff0c\u7136\u540ecat\u8fd4\u56de\u5931\u8d25\u72b6\u6001\u7801\uff0c\u5176\u4e2d\uff0cperiodSeconds\u89c4\u5b9akubelet\u6bcf\u969410s\u6267\u884c\u4e00\u6b21liveness probe\uff0c<code>initialDelaySeconds<\/code>&nbsp;\u544a\u8bc9kubelet \u5728\u7b2c\u4e00\u6b21\u6267\u884c probe \u4e4b\u524d\u8981\u7684\u7b49\u5f8530\u79d2\u949f(\u56e0\u4e3a\u6709\u4e9b\u5bb9\u5668\u53ef\u80fd\u542f\u52a8\u6bd4\u8f83\u6162\uff0c\u9700\u8981\u62c9\u955c\u50cf\uff0c\u56e0\u6b64\u9700\u8981\u7b49\u5f85\u4e45\u4e00\u70b9\uff0c\u4ee5\u514d\u8bef\u5224)&nbsp;\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"355\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/1.png\" alt=\"\" class=\"wp-image-6216\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/1.png 706w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/1-300x151.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/1-600x302.png 600w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\u3001TCPSocketAction<\/strong>\uff1a\u901a\u8fc7\u5bb9\u5668\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u53f7\u6267\u884cTCP\u68c0\u67e5\uff0c\u5982\u679c\u80fd\u591f\u5efa\u7acbTCP\u8fde\u63a5\uff0c\u5219\u8868\u660e\u5bb9\u5668\u5065\u5eb7<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762pod\u4e2d\uff0c\u901a\u8fc7\u4e0e\u5bb9\u5668\u5185\u76848080\u7aef\u53e3\u5efa\u7acbtcp\u8fde\u63a5\u6765\u8fdb\u884c\u5065\u5eb7\u68c0\u67e5\uff0c\u5982\u679c8080\u7aef\u53e3\u4e0d\u901a\uff0c\u90a3\u4e48\u6b64Pod\u5c06\u88ab\u6740\u6389\u7136\u540e\u91cd\u542f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"290\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/2-1.png\" alt=\"\" class=\"wp-image-6218\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/2-1.png 707w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/2-1-300x123.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/2-1-600x246.png 600w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3\u3001HTTPGetAction\uff1a<\/strong>\u901a\u8fc7\u5bb9\u5668\u7684IP\u5730\u5740\u3001\u7aef\u53e3\u53f7\u53ca\u8def\u5f84\u8c03\u7528HTTP Get\u65b9\u6cd5\uff0c\u5982\u679c\u54cd\u5e94\u7684\u72b6\u6001\u7801\u5927\u4e8e\u7b49\u4e8e200\u4e14\u5c0f\u4e8e400\uff0c\u5219\u8ba4\u4e3a\u5bb9\u5668\u5065\u5eb7\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u4f8b\u5b50\u8868\u793a\u63a2\u6d4bnginx\u5bb9\u5668\uff0c\u8def\u5f84\u5c31\u662fnginx\u7684\u9ed8\u8ba4\u8bbf\u95ee\u9875\u9762\u5730\u5740\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"317\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3-1.png\" alt=\"\" class=\"wp-image-6221\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3-1.png 702w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3-1-300x135.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/3-1-600x271.png 600w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efapod\u540e\u89c2\u5bdf\u91cd\u542f\u6b21\u6570\uff0c\u53ef\u4ee5\u770b\u5230\u91cd\u542f\u6b21\u6570\u4e3a0 \uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"102\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4-1.png\" alt=\"\" class=\"wp-image-6223\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4-1.png 702w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4-1-300x44.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/4-1-600x87.png 600w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u5728\u8fdb\u5165\u5bb9\u5668\uff0c\u5220\u9664\u9ed8\u8ba4\u7684\u8bbf\u95ee\u9875\u9762index.html\uff0c\u7136\u540e\u518d\u89c2\u5bdf\u91cd\u542f\u6b21\u6570\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl exec -it liveness-httpget-pod -- rm -f \/usr\/share\/nginx\/html\/index.html<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u89c2\u5bdf\u91cd\u542f\u6b21\u6570\u4e3a1\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"100\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5-1.png\" alt=\"\" class=\"wp-image-6225\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5-1.png 700w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5-1-300x43.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/5-1-600x86.png 600w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u63cf\u8ff0\u4fe1\u606f\u91cc\u53ef\u4ee5\u770b\u5230\u63d0\u793a\u627e\u4e0d\u5230\u6587\u4ef6\uff0c\u62a5\u9519404\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"174\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6-1.png\" alt=\"\" class=\"wp-image-6227\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6-1.png 704w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6-1-300x74.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/6-1-600x148.png 600w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u91cd\u542f\u540e\u7684Pod,\u5185\u90e8\u4f1a\u91cd\u65b0\u751f\u6210index.html\uff0c\u56e0\u6b64\u518d\u6b21\u5065\u5eb7\u68c0\u67e5\u5c06\u6210\u529f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9 \u4e8e \u6bcf \u79cd \u63a2 \u6d4b \u65b9 \u5f0f \uff0c \u90fd \u9700 \u8981 \u8bbe \u7f6e initialDelaySeconds \u548ctimeoutSeconds\u4e24\u4e2a\u53c2\u6570\uff0c\u5b83\u4eec\u7684\u542b\u4e49\u5206\u522b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>initialDelaySeconds\uff1a\u542f\u52a8\u5bb9\u5668\u540e\u8fdb\u884c\u9996\u6b21\u5065\u5eb7\u68c0\u67e5\u7684\u7b49\u5f85\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3as\u3002<\/li>\n\n\n\n<li>timeoutSeconds\uff1a\u5065\u5eb7\u68c0\u67e5\u53d1\u9001\u8bf7\u6c42\u540e\u7b49\u5f85\u54cd\u5e94\u7684\u8d85\u65f6\u65f6\u95f4\u5355\u4f4d\u4e3as\u3002\u5f53\u8d85\u65f6\u53d1\u751f\u65f6\uff0ckubelet\u4f1a\u8ba4\u4e3a\u5bb9\u5668\u5df2\u7ecf\u65e0\u6cd5\u63d0\u4f9b\u670d\u52a1\uff0c\u5c06\u4f1a\u91cd\u542f\u8be5\u5bb9\u5668<\/li>\n\n\n\n<li>periodSeconds\uff1a\u89c4\u5b9akubelet\u6bcf\u9694\u4e00\u5b9a\u65f6\u95f4\u6267\u884c\u4e00\u6b21liveness probe\uff0c\u5355\u4f4d\u662fs<\/li>\n\n\n\n<li>successThreshold:  \u68c0\u67e5\u6210\u529f\u51e0\u6b21\u540e\u8868\u793a\u5c31\u7eea\uff0c\u6bd4\u5982\u8bbe\u7f6e\u4e3a2\uff0c\u5219\u4e3a2\u6b21\u6210\u529f\u540e\u5c31\u7eea<\/li>\n\n\n\n<li>failureThreshold\uff1a  \u68c0\u67e5\u5931\u8d25\u51e0\u6b21\u540e\u8868\u793a\u672a\u5c31\u7eea\uff0c\u5982\u8bbe\u7f6e1\uff0c\u5219\u4e3a\u68c0\u67e5\u5931\u8d251\u6b21\u540e\u8868\u793a\u672a\u5c31\u7eea<\/li>\n<\/ul>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\uff1a\u751f\u4ea7\u73af\u5883\u5efa\u8bae\u4f7f\u7528httpGet\u5b9e\u73b0\u63a5\u53e3\u7ea7\u5065\u5eb7\u68c0\u67e5<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001Pod\u751f\u547d\u5468\u671f\u548c\u91cd\u542f\u7b56\u7565\uff1a Pod\u5728\u6574\u4e2a\u751f\u547d\u5468\u671f\u4e2d\u88ab\u7cfb\u7edf\u5b9a\u4e49\u4e3a\u5404\u79cd\u72b6\u6001\uff0c\u719f\u6089Pod\u7684\u5404\u79cd\u72b6\u6001 \u5bf9\u4e8e\u7406\u89e3\u5982\u4f55 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":4949,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,23],"tags":[],"class_list":["post-4948","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\/4948","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=4948"}],"version-history":[{"count":23,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/4948\/revisions"}],"predecessor-version":[{"id":19342,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/4948\/revisions\/19342"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/4949"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=4948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=4948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=4948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}