{"id":1655,"date":"2022-02-20T12:56:11","date_gmt":"2022-02-20T04:56:11","guid":{"rendered":"https:\/\/www.chenqing.work\/?p=1655"},"modified":"2023-05-15T15:45:04","modified_gmt":"2023-05-15T07:45:04","slug":"a-little-problem-%e4%bb%80%e4%b9%88%e6%98%af-pod-%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.chenqing.work\/?p=1655","title":{"rendered":"\u4e91\u539f\u751f\uff0cPart 2 | \u4ec0\u4e48\u662f Pod \uff1f"},"content":{"rendered":"\n<p>\u5148\u6316\u5751\uff0c\u518d\u586b\u571f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.chenqing.work\/?p=1492\" data-type=\"URL\" data-id=\"https:\/\/www.chenqing.work\/?p=1492\">\u4e91\u539f\u751f\uff0cPart 0\uff1a\u4ec0\u4e48\u662f Image \uff1f<\/a><\/li>\n\n\n\n<li>\u4e91\u539f\u751f\uff0cPart 1\uff1a\u4ec0\u4e48\u662f Container \uff1f<\/li>\n\n\n\n<li>\u4e91\u539f\u751f\uff0cPart 2\uff1a\u4ec0\u4e48\u662f Pod \uff1f<\/li>\n\n\n\n<li>\u4e91\u539f\u751f\uff0cPart 3\uff1a\u4ec0\u4e48\u662f Pod \u8c03\u5ea6 \uff1f<\/li>\n\n\n\n<li>&#8230;<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u5148\u4e0a\u7ed3\u8bba\uff1aPod \u5c31\u662f\u4e00\u4e2a\u5904\u5728\u6682\u505c\u72b6\u6001\u7684 infra \u5bb9\u5668\uff08+ \u52a0\u5165 infra \u5bb9\u5668\u7684 namespace \u7684\u5e94\u7528\u5bb9\u5668\uff09\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u4ecb\u7ecd\">\u4ecb\u7ecd<\/h2>\n\n\n\n<p>\u5728 k8s \u53d1\u5e03\u4ee5\u524d\uff0c\u53ea\u6709\u955c\u50cf\u548c\u5bb9\u5668\u7684\u6982\u5ff5\uff0c\u4f34\u968f\u7740 k8s \u7684\u6a2a\u7a7a\u51fa\u4e16\uff0c\u624d\u6709\u4e86 Pod \u8fd9\u4e2a\u6982\u5ff5\u3002<\/p>\n\n\n\n<p>Pod \u662f\u4e00\u4e2a\u903b\u8f91\u6982\u5ff5\uff0c\u5b9e\u9645\u5728\u8282\u70b9\u4e0a\u8fd0\u884c\u7684\u4ecd\u7136\u662f\u5bb9\u5668\u3002\u800c\u591a\u4e2a\u5bb9\u5668\u4e4b\u95f4\u5982\u4f55\u5efa\u7acb\u201c\u8d85\u4eb2\u5bc6\u5173\u7cfb\u201d\uff0c\u8fdb\u800c\u6210\u4e3a\u4e00\u7ec4\u5bb9\u5668\uff0c\u8fd9\u4e00\u7ec4\u5bb9\u5668\u53c8\u662f\u5982\u4f55\u548c Pod \u5efa\u7acb\u5bf9\u5e94\u5173\u7cfb\uff1f<\/p>\n\n\n\n<p>\u8fd9\u4e9b\u90fd\u8981\u9760\u4e00\u4e2a\u951a\u70b9\u5bb9\u5668\u2014\u2014 infra \u5bb9\u5668\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5b9e\u9a8c\">\u5b9e\u9a8c<\/h2>\n\n\n\n<p>\u65e0\u9700\u8fd0\u884c k8s \u96c6\u7fa4\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528\u7ea2\u5e3d\u63d0\u4f9b\u7684\u5de5\u5177 Podman\uff0c\u6765\u8fd1\u8ddd\u79bb\u89c2\u5bdf\u4e00\u4e0b Pod\u3002<\/p>\n\n\n\n<p>\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b Podman\uff0cPodman \u662f\u7ea2\u5e3d\u5bb9\u5668\u4e09\u4ef6\u5957\u4e4b\u4e00\uff08\u53e6\u4e24\u4e2a\u662f buildah\u3001skopeo\uff09\uff0c\u5b8c\u5168\u5bf9\u6807 docker \u547d\u4ee4\u884c\u5de5\u5177\u2014\u2014\u5982\u679c\u4e60\u60ef\u4e86\u6572 docker\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728 shell \u7684\u914d\u7f6e\u4e2d\u5c06 docker \u8bbe\u4e3a podman \u7684 alias\uff0c\u5c31\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528 docker  \u7684\u51e0\u4e4e\u6240\u6709\u547d\u4ee4\u5f62\u5f0f\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\uff0c\u5728\u6211\u521a\u88c5\u7684 fedora workstation 35 \u4e0a\uff0c\u6211\u4eec\u7528 podman \u521b\u5efa\u4e00\u4e2a pod\uff0c\u540d\u79f0\u8bbe\u4e3a test-pod\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npodman pod create --name test-pod\n<\/pre><\/div>\n\n\n<p>\u6709\u7684\u540c\u5b66\u5728\u8fd9\u91cc\u4f1a\u9047\u5230\u4e00\u4e2a\u95ee\u9898\uff0c\u56e0\u4e3a\u6211\u4eec\u524d\u9762\u63d0\u5230 Pod \u5728\u5bb9\u5668\u8fd9\u4e00\u5c42\u7684\u951a\u70b9\u662f\u4e00\u4e2a infra \u5bb9\u5668\uff0c\u6240\u4ee5\u521b\u5efa Pod \u65f6\uff0c\u9996\u5148\u4f1a\u521b\u5efa infra \u5bb9\u5668\uff0cinfra \u5bb9\u5668\u6240\u7528\u7684\u955c\u50cf\u5c31\u662f k8s.gcr.io\/pause\uff0c\u8fde\u63a5\u5931\u8d25\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1519\" height=\"89\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-19.png\" alt=\"\" class=\"wp-image-1676\"\/><\/figure>\n\n\n\n<p>\u5982\u679c\u51fa\u73b0\u8fd9\u6837\u7684\u62a5\u9519\uff0c\u6211\u4eec\u53ef\u4ee5\u5148\u4ece\u963f\u91cc\u7684\u955c\u50cf\u4ed3\u5e93\u62c9\u4e00\u4e2a pause \u955c\u50cf\uff0c\u518d tag \u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npodman pull registry.aliyuncs.com\/google_containers\/pause:3.5\npodman tag ed k8s.gcr.io\/pause:3.5\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1027\" height=\"143\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-18.png\" alt=\"\" class=\"wp-image-1674\"\/><\/figure>\n\n\n\n<p>Pod \u521b\u5efa\u5b8c\u6bd5\uff0c\u5728\u6211\u4eec\u6ca1\u6709\u8fd0\u884c\u4efb\u4f55\u5e94\u7528\u7684\u60c5\u51b5\u4e0b\uff0c\u770b\u5230\u5df2\u7ecf\u521b\u5efa\u4e86\u4e00\u4e2a pause \u5bb9\u5668\uff0c\u5e76\u4e14\u5904\u4e8e\u6682\u505c\u72b6\u6001\u3002\u4ece<a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/blob\/master\/build\/pause\/linux\/pause.c\" data-type=\"URL\" data-id=\"https:\/\/github.com\/kubernetes\/kubernetes\/blob\/master\/build\/pause\/linux\/pause.c\">\u6e90\u7801<\/a>\u770b\uff0cpause \u5bb9\u5668\u8fd0\u884c\u4e86\u4e00\u4e2a\u5904\u4e8e\u7761\u7720\u72b6\u6001\u7684\u8fdb\u7a0b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1289\" height=\"220\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-21.png\" alt=\"\" class=\"wp-image-1687\"\/><\/figure>\n\n\n\n<p>1\u4e2a Pod \u53ef\u4ee5\u5bb9\u7eb3\u591a\u4e2a\u5bb9\u5668\u8fd0\u884c\uff0c\u8fd9\u662f Pod \u7684\u53e6\u4e00\u4e2a\u7cbe\u9ad3\u6240\u5728\uff0c\u73b0\u5728\u6211\u4eec\u5f80 Pod \u91cc\u6dfb\u52a0\u4e00\u4e2a nginx \u7684\u5bb9\u5668\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"328\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-24.png\" alt=\"\" class=\"wp-image-1697\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1633\" height=\"102\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-23.png\" alt=\"\" class=\"wp-image-1696\"\/><\/figure>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5bf9 Pod \u4e2d\u7684\u5bb9\u5668\u8fdb\u884c\u6e05\u7406\u3002\u5c1d\u8bd5\u4f7f\u7528 podman \u76f4\u63a5\u5220\u9664 infra \u5bb9\u5668\uff0c\u63d0\u793a\u5fc5\u987b\u5148\u5220\u9664 Pod\u3002\u5c1d\u8bd5\u5220\u9664 nginx \u5e94\u7528\u5bb9\u5668\uff0c\u6210\u529f\u3002\u4e5f\u5c31\u662f\u8bf4\uff0cInfra \u5728 Pod \u5728\uff0cInfra \u4ea1 Pod \u4ea1\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1644\" height=\"343\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-25.png\" alt=\"\" class=\"wp-image-1699\"\/><\/figure>\n\n\n\n<p>\u591a\u5bb9\u5668\u7684\u6a21\u5f0f\uff0c\u662f\u4e00\u4e2a\u5173\u6ce8\u70b9\u5206\u79bb\u539f\u5219\u7684\u6781\u597d\u5b9e\u8df5\u3002infra \u5bb9\u5668\u548c\u5177\u4f53\u5e94\u7528\u65e0\u5173\uff0c\u4f5c\u4e3a Pod \u7684\u951a\u70b9\u3001\u8d44\u6e90\u7684\u951a\u70b9\u3001\u9694\u79bb\u7684\u951a\u70b9\uff0c\u5173\u6ce8\u5e73\u53f0\u8fd0\u7ef4\u5c42\u9762\u7684\u9700\u6c42\u3002\u5e94\u7528\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u5173\u6ce8\u70b9\uff0c\u5207\u5206\u51fa\u591a\u4e2a\u5bb9\u5668\uff0c\u53c8\u6216\u8005\u5728\u5e94\u7528\u5b8c\u5168\u4e0d\u77e5\u60c5\u7684\u60c5\u51b5\u4e0b\uff0c\u7531\u7b2c\u4e09\u65b9\u76f4\u63a5\u6ce8\u5165\u4e00\u4e2a\u5bb9\u5668\u8fdb\u6765\uff0c\u4ee5\u975e\u4ee3\u7801\u4fb5\u5165\u7684\u65b9\u5f0f\u62bd\u53d6\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u6bd4\u7167 OO \u91cc\u7684\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u5728 k8s \u91cc\u4e5f\u6709\u4e86 init Container\u3001sidecar\u3001adapter\u3001ambassador \u8fd9 4 \u79cd\u7ed3\u6784\u578b\u8bbe\u8ba1\u6a21\u5f0f\u3002<\/p>\n\n\n\n<p>\u5728 k8s \u91cc\uff0cPod \u4f5c\u4e3a\u88ab\u7ba1\u7406\u548c\u8c03\u5ea6\u7684\u57fa\u672c\u5355\u4f4d\uff0c\u7531 scheduler \u8d1f\u8d23\u8ba1\u7b97\u51fa\u6ee1\u8db3 Pod \u8981\u6c42\u7684\u8282\u70b9\uff0c\u5e76\u7531\u5bf9\u5e94\u8282\u70b9\u4e0a\u7684 kubelet \u8d1f\u8d23\u521b\u5efa Pod\uff0c\u4ee5\u5b9e\u73b0\u8c03\u5ea6\u884c\u4e3a\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u6700\u540e\">\u6700\u540e<\/h2>\n\n\n\n<p><strong>infra \u5bb9\u5668\u5c31\u662f Pod \u6982\u5ff5\u7684\u951a\u70b9\u3002<\/strong><\/p>\n\n\n\n<p>infra \u5bb9\u5668\u7684\u7cbe\u9ad3\uff0c\u5176\u5b9e\u5728\u4e8e linux \u4e2d\u65e9\u5c31\u5b58\u5728\u7684 cgroups\u3001namespace\uff0c\u7406\u8bba\u4e0a\u6bcf\u4e2a linux \u8fdb\u7a0b\u90fd\u8fd0\u884c\u5728\u5bb9\u5668\u91cc\uff0c\u5c5e\u4e8e\u5178\u578b\u7684\u8001\u6811\u53d1\u65b0\u82bd\u4e86\u3002\u4e0b\u6b21\u518d\u804a\u804a\u8fd9\u4e2a\u3002<\/p>\n\n\n\n<p>\u8f6f\u4ef6\u91cc\u5bf9\u4e8e\u6982\u5ff5\u548c\u5b9e\u4f53\u7684\u533a\u5206\uff0c\u6709\u65f6\u5019\u5b8c\u5168\u53d6\u51b3\u4e8e\u4f60\u4ece\u54ea\u4e00\u4e2a\u62bd\u8c61\u5c42\u9762\u53bb\u7406\u89e3\u3002\u4e0d\u77e5\u5468\u4e4b\u68a6\u4e3a\u80e1\u8776\u4e0e\uff1f\u80e1\u8776\u4e4b\u68a6\u4e3a\u5468\u4e0e\uff1f<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u66f4\u591a\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.podman.io\/en\/latest\/\">https:\/\/docs.podman.io\/en\/latest\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mkdev.me\/en\/posts\/dockerless-part-3-moving-development-environment-to-containers-with-podman\">Dockerless, part 3: Moving development environment to containers with Podman | articles about programming on mkdev<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/linchpiner.github.io\/k8s-multi-container-pods.html\">Multi-Container Pods in Kubernetes (linchpiner.github.io)<\/a><\/li>\n\n\n\n<li>\u300a\u6df1\u5165\u5256\u6790 Kubernetes\u300b<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u6316\u5751\uff0c\u518d\u586b\u571f \u5148\u4e0a\u7ed3\u8bba\uff1aPod \u5c31\u662f\u4e00\u4e2a\u5904\u5728\u6682\u505c\u72b6\u6001\u7684 infra \u5bb9\u5668\uff08+ \u52a0\u5165 infra \u5bb9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[63,62],"class_list":["post-1655","post","type-post","status-publish","format-standard","hentry","category-code","tag-pod","tag-podman"],"_links":{"self":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/1655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1655"}],"version-history":[{"count":68,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/1655\/revisions"}],"predecessor-version":[{"id":8891,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/1655\/revisions\/8891"}],"wp:attachment":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}