{"id":225668,"date":"2023-12-21T11:40:05","date_gmt":"2023-12-21T03:40:05","guid":{"rendered":"https:\/\/www.idc.net\/help\/225668\/"},"modified":"2023-12-21T11:40:05","modified_gmt":"2023-12-21T03:40:05","slug":"k8s%e4%b8%ad%e7%9a%84pod%e5%92%8c%e5%ae%b9%e5%99%a8%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/225668\/","title":{"rendered":"K8s\u4e2d\u7684Pod\u548c\u5bb9\u5668\u8bbe\u8ba1\u6a21\u5f0f"},"content":{"rendered":"<h1>K8s\u4e2d\u7684Pod\u548c\u5bb9\u5668\u8bbe\u8ba1\u6a21\u5f0f<\/h1>\n<p><span>\u4f5c\u8005\uff1a\u79fb\u52a8Labs<\/span> 2022-06-01 09:38:36<br \/>\n<i><\/i><br \/>\n<span>\u4e91\u8ba1\u7b97<\/span> \u5728\u88ab\u8a89\u4e3a\u4e91\u65f6\u4ee3\u7684\u64cd\u4f5c\u7cfb\u7edfKubernetes \u4e2d\uff0c\u5bb9\u5668\u88ab\u7c7b\u6bd4\u4e3a\u4e86\u8fdb\u7a0b\uff0c\u90a3\u4e48Pod\u5462\uff1f\u5176\u5b9e Pod \u53ea\u662f\u4e00\u4e2a\u62bd\u8c61\u7684\u903b\u8f91\u6982\u5ff5\uff0c\u5b83\u53ef\u4ee5\u7c7b\u6bd4\u4e3a\u524d\u9762\u4f8b\u5b50\u4e2d\u7684java\u7a0b\u5e8f\u4e00\u6837\uff0c\u662f\u4e00\u7ec4\uff08\u4e00\u4e2a\u6216\u8005\u591a\u4e2a\uff09\u5bb9\u5668\u7684\u96c6\u5408\uff0c\u8fd9\u4e9b\u5bb9\u5668\u4e4b\u95f4\u5171\u4eab\u540c\u4e00\u4efd\u7f51\u7edc\uff08Network Namespace\uff09\u548c\u5b58\u50a8\uff08Volume\uff09\u7b49\u8d44\u6e90\u3002<br \/>\n<span><\/span> <\/p>\n<p>\u4f5c\u8005 \uff5c \u4e2d\u56fd\u79fb\u52a8\u4e91\u80fd\u529b\u4e2d\u5fc3PaaS\u4ea7\u54c1\u90e8 \u4ec7\u660e<\/p>\n<p>\u200b\u8fd1\u4e9b\u5e74\u6765\uff0c\u5bb9\u5668\u6280\u672f\u8fc5\u901f\u5e2d\u5377\u5168\u7403\uff0c\u98a0\u8986\u4e86\u5e94\u7528\u7684\u5f00\u53d1\u3001\u4ea4\u4ed8\u548c\u8fd0\u884c\u6a21\u5f0f\u3002\u5bb9\u5668\u6280\u672f\u4f5c\u4e3a\u4e91\u539f\u751f\u6280\u672f\u9886\u57df\u7684\u6280\u672f\u57fa\u77f3\uff0c\u4e5f\u662f\u73b0\u4eca\u6700\u70ed\u95e8\u7684\u4e00\u79cd\u670d\u52a1\u5668\u7aef\u6280\u672f\u3002\u5bb9\u5668\u4ee5\u53ca\u5bb9\u5668\u7f16\u6392\u6280\u672f\u6210\u4e3a\u57fa\u7840\u8bbe\u65bd\u9886\u57df\u6700\u7099\u624b\u53ef\u70ed\u7684\u5173\u952e\u8bcd\uff0c\u968f\u7740\u5bb9\u5668\u53ca\u5468\u8fb9\u751f\u6001\u6280\u672f\u7684\u84ec\u52c3\u53d1\u5c55\uff0c\u5bb9\u5668\u793e\u533a\u5f53\u4ec1\u4e0d\u8ba9\u6210\u4e3a\u5f00\u6e90\u793e\u533a\u6700\u6d3b\u8dc3\u7684\u751f\u6001\u5708\u4e4b\u4e00\u3002\u540c\u65f6\uff0c\u4ee5\u5bb9\u5668\u6280\u672f\u4e3a\u6838\u5fc3\u7684\u5bb9\u5668\u751f\u6001\u5708\u5728\u4e91\u8ba1\u7b97\u3001\u4e92\u8054\u7f51\u7b49\u9886\u57df\u5f97\u5230\u4e86\u5e7f\u6cdb\u5e94\u7528\u3002<\/p>\n<\/p>\n<h2>01\u5bb9\u5668\u7684\u6982\u5ff5<\/h2>\n<\/p>\n<p>\u65e9\u57282000\u5e74\uff0c\u5bb9\u5668\u6280\u672f\u7684\u6982\u5ff5\u5c31\u5df2\u7ecf\u51fa\u73b0\uff0c\u5f53\u521d\u662f\u7528\u5728chroot\u73af\u5883\u4e2d\u505a\u8fdb\u7a0b\u9694\u79bb\u30022013\u5e74\uff0cDocker\u9879\u76ee\u6b63\u5f0f\u53d1\u5e03\uff0c\u8ba9Linux\u5bb9\u5668\u6280\u672f\u9010\u6b65\u5e2d\u5377\u5929\u4e0b\u30022014 \u5e74\uff0cKubernetes\u9879\u76ee\u6b63\u5f0f\u53d1\u5e03\uff0c\u5bb9\u5668\u6280\u672f\u5f00\u59cb\u548c\u7f16\u6392\u7cfb\u7edf\u9f50\u5934\u5e76\u8fdb\u3002<\/p>\n<\/p>\n<p>\u5bb9\u5668\u7684\u672c\u8d28\uff0c\u662f\u4e00\u4e2a\u8bd5\u56fe\u88ab\u9694\u79bb\uff0c\u8d44\u6e90\u53d7\u9650\u5236\u7684\u8fdb\u7a0b\u3002\u6240\u4f7f\u7528\u7684\u9694\u79bb\u6280\u672f\u90fd\u662f\u57fa\u4e8eLinux\u5185\u6838\u63d0\u4f9b\uff0c\u5176\u4e2dnamespace\u7528\u6765\u505a\u8d44\u6e90\u9694\u79bb\uff0ccgroups\u7528\u6765\u505a\u8d44\u6e90\u9650\u5236\uff08CPU\u3001\u5185\u5b58\u3001\u5b58\u50a8\u3001\u7f51\u7edc\u7684\u4f7f\u7528\u9650\u5236\uff09\u3002\u9694\u79bb\u6280\u672f\u4e2d\u4e0d\u5f97\u4e0d\u63d0\u7684\u662f\u865a\u62df\u673a\u3002\u901a\u8fc7\u5982\u4e0b\u7684\u865a\u62df\u673a\u548c\u5bb9\u5668\u7684\u5bf9\u6bd4\u56fe\uff0c\u53ef\u4ee5\u770b\u51fa\uff0c\u865a\u62df\u673a\u5de5\u4f5c\u539f\u7406\u4e2d\u6700\u91cd\u8981\u7684\u662fHypervisor\u5c42\u2014\u2014\u8fdb\u884c\u786c\u4ef6\u865a\u62df\u5316\u529f\u80fd\uff0c\u6a21\u62df\u51fa\u8fd0\u884c\u64cd\u4f5c\u7cfb\u7edf\u9700\u8981\u7684\u5404\u79cd\u786c\u4ef6\uff08\u5982 CPU\u3001\u5185\u5b58\u3001I\/O \u8bbe\u5907\u7b49\uff09\uff0c\u7136\u540e\uff0c\u5728\u8fd9\u4e9b\u865a\u62df\u786c\u4ef6\u4e0a\u5b89\u88c5\u64cd\u4f5c\u7cfb\u7edfGuest OS\u3002\u800c\u5bb9\u5668\u6ca1\u6709\u81ea\u5df1\u7684OS\uff0c\u901a\u8fc7Container Daemon\u76f4\u63a5\u5171\u4eab\u5bbf\u4e3b\u673a\u5185\u6838\uff0c\u6240\u6709\u5bf9\u5bb9\u5668\u8fdb\u7a0b\u7684\u9650\u5236\u90fd\u662f\u57fa\u4e8e\u5bbf\u4e3b\u673a\u64cd\u4f5c\u7cfb\u7edf\u672c\u8eab\u80fd\u529b\u8fdb\u884c\u3002\u6545\u800c\uff0c\u5bb9\u5668\u4e5f\u663e\u5f97\u5f88\u8f7b\u91cf\u5316\u3002<\/p>\n<\/p>\n<p style=\"text-align: center\">\n<\/p>\n<\/p>\n<h2>02Pod\u6982\u5ff5<\/h2>\n<\/p>\n<h3>2.1 \u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u4f8b\u5b50<\/h3>\n<\/p>\n<p>\u9996\u5148\uff0c\u5728\u865a\u62df\u673a\u4e2d\u8fd0\u884c\u4e00\u4e2a\u7b80\u5355\u7684java\u7a0b\u5e8f\uff0c\u7136\u540e\u901a\u8fc7pstree\u6307\u4ee4\uff0c\u5c06\u4f1a\u770b\u5230\u8fd9\u4e2ajava\u7a0b\u5e8f\u5b9e\u9645\u4e0a\u662f\u7531\u4e00\u7ec4\uff08linux\u4e2d\uff09\u7ebf\u7a0b\u7ec4\u6210\uff0c\u5171\u4eab\u8d44\u6e90\uff0c\u5171\u540c\u534f\u4f5c\u5b8c\u6210java\u7a0b\u5e8f\u7684\u4e1a\u52a1\u5de5\u4f5c\u3002<\/p>\n<\/p>\n<p style=\"text-align: center\">\n<\/p>\n<h3>2.2 Pod\u5b9e\u73b0\u539f\u7406<\/h3>\n<\/p>\n<p>\u5728\u88ab\u8a89\u4e3a\u4e91\u65f6\u4ee3\u7684\u64cd\u4f5c\u7cfb\u7edfKubernetes \u4e2d\uff0c\u5bb9\u5668\u88ab\u7c7b\u6bd4\u4e3a\u4e86\u8fdb\u7a0b\uff0c\u90a3\u4e48Pod\u5462\uff1f\u5176\u5b9e Pod \u53ea\u662f\u4e00\u4e2a\u62bd\u8c61\u7684\u903b\u8f91\u6982\u5ff5\uff0c\u5b83\u53ef\u4ee5\u7c7b\u6bd4\u4e3a\u524d\u9762\u4f8b\u5b50\u4e2d\u7684java\u7a0b\u5e8f\u4e00\u6837\uff0c\u662f\u4e00\u7ec4\uff08\u4e00\u4e2a\u6216\u8005\u591a\u4e2a\uff09\u5bb9\u5668\u7684\u96c6\u5408\uff0c\u8fd9\u4e9b\u5bb9\u5668\u4e4b\u95f4\u5171\u4eab\u540c\u4e00\u4efd\u7f51\u7edc\uff08Network Namespace\uff09\u548c\u5b58\u50a8\uff08Volume\uff09\u7b49\u8d44\u6e90\u3002<\/p>\n<\/p>\n<h4>2.2.1 \u7f51\u7edc\u5171\u4eab<\/h4>\n<\/p>\n<p>Pod\u4e2d\u9996\u5148\u4f1a\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u5bb9\u5668\uff08Infra container\uff09\uff0c\u7136\u540e\u4ee5join network namespace\u7684\u65b9\u5f0f\uff0c\u5c06\u5176\u5b83\u5bb9\u5668\u90fd\u4e0e\u57fa\u7840\u5bb9\u5668\u7684\u7f51\u7edc\u5173\u8054\u8d77\u6765\uff0c\u8fd9\u6837\u5c31\u5b9e\u73b0\u4e86pod\u5185\u5bb9\u5668\u95f4\u5171\u4eab\u7f51\u7edc\u8d44\u6e90\u7684\u529f\u80fd\u3002\u6240\u4ee5\u57fa\u7840\u5bb9\u5668\u6c38\u8fdc\u90fd\u662fPod \u91cc\u9762\u7b2c\u4e00\u4e2a\u88ab\u521b\u5efa\u7684\u5bb9\u5668\uff0c\u7b49\u5f85\u5176\u4ed6\u5bb9\u5668\u7684\u52a0\u5165\u3002Pod\u7684\u751f\u547d\u5468\u671f\u53ea\u8ddf\u57fa\u7840\u5bb9\u5668\u4e00\u81f4\u3002\u57fa\u7840\u5bb9\u5668\u662f\u4e00\u4e2a\u975e\u5e38\u5c0f\u7684\u955c\u50cf\uff0c\u53eb\u505a k8s.gcr.io\/pause\uff0c\u5927\u6982 100~200KB \u5de6\u53f3\uff0c\u662f\u4e00\u4e2a\u6c47\u7f16\u8bed\u8a00\u5199\u7684\u3001\u6c38\u8fdc\u5904\u4e8e\u201c\u6682\u505c\u201d\u72b6\u6001\u7684\u5bb9\u5668\u3002<\/p>\n<\/p>\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<\/p>\n<h4>2.2.2 \u5b58\u50a8\u5171\u4eab<\/h4>\n<\/p>\n<p>Pod\u662f\u901a\u8fc7Volume\u5b9e\u73b0\u5171\u4eab\u5b58\u50a8\u7684\u3002Pod\u5148\u7ed1\u5b9a\u597dVolume\uff0c\u7136\u540ePod\u91cc\u7684\u5bb9\u5668\u53ea\u8981\u58f0\u660e\u6302\u8f7d\u8fd9\u4e2aVolume\uff0c\u5c31\u53ef\u4ee5\u5171\u4eab\u8fd9\u4e2aVolume\u5bf9\u5e94\u7684\u5bbf\u4e3b\u673a\u76ee\u5f55\uff0c\u6240\u6709\u5bb9\u5668\u770b\u5230\u7684\u8fd9\u4e2aVolume\u76ee\u5f55\u5185\u5bb9\u90fd\u662f\u4e00\u6837\u7684\u3002\u4ee5\u4e0byaml\u63d0\u4f9b\u4e86\u5355Pod\u5185\u542f\u4e24\u4e2a\u5bb9\u5668\u7684\u793a\u4f8b\u3002<\/p>\n<p style=\"text-align: right\">\n<p style=\"text-align: right\">\n<p style=\"text-align: right\">\n<p style=\"text-align: right\">\n<p style=\"text-align: right\">\n<p style=\"text-align: right\">\n<p style=\"text-align: right\">\n<p style=\"text-align: right\">\n<pre><span style=\"margin: 0px;padding: 0px\">apiVersion<\/span>: <span style=\"margin: 0px;padding: 0px\">v1<\/span><br><span style=\"margin: 0px;padding: 0px\">kind<\/span>: <span style=\"margin: 0px;padding: 0px\">Pod<\/span><br><span style=\"margin: 0px;padding: 0px\">metadata<\/span>:<br>  <span style=\"margin: 0px;padding: 0px\">name<\/span>: <span style=\"margin: 0px;padding: 0px\">one<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">pod<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">two<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">container<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">demo<\/span><br><span style=\"margin: 0px;padding: 0px\">spec<\/span>:<br>  <span style=\"margin: 0px;padding: 0px\">volumes<\/span>:                  <span style=\"margin: 0px;padding: 0px\">#Pod\u5148\u7ed1\u5b9a\u597dVolume<\/span><br>    <span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">name<\/span>: <span style=\"margin: 0px;padding: 0px\">shared<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">logs<\/span><br>      <span style=\"margin: 0px;padding: 0px\">emptyDir<\/span>: {}<br>  <span style=\"margin: 0px;padding: 0px\">containers<\/span>:<br>    <span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">name<\/span>: <span style=\"margin: 0px;padding: 0px\">web<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">nginx<\/span><br>      <span style=\"margin: 0px;padding: 0px\">image<\/span>: <span style=\"margin: 0px;padding: 0px\">nginx<\/span><br>      <span style=\"margin: 0px;padding: 0px\">volumeMounts<\/span>:          <span style=\"margin: 0px;padding: 0px\">#\u5bb9\u5668\u518d\u6302\u8f7d\u8fd9\u4e2avolume<\/span><br>        <span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">name<\/span>: <span style=\"margin: 0px;padding: 0px\">shared<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">logs<\/span><br>          <span style=\"margin: 0px;padding: 0px\">mountPath<\/span>: <span style=\"margin: 0px;padding: 0px\">\/var\/<\/span><span style=\"margin: 0px;padding: 0px\">log<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span><span style=\"margin: 0px;padding: 0px\">nginx<\/span><br>    <span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">name<\/span>: <span style=\"margin: 0px;padding: 0px\">sidecar<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">container<\/span><br>      <span style=\"margin: 0px;padding: 0px\">image<\/span>: <span style=\"margin: 0px;padding: 0px\">busybox<\/span><br>      <span style=\"margin: 0px;padding: 0px\">command<\/span>: [<span style=\"margin: 0px;padding: 0px\">\"sh\"<\/span>,<span style=\"margin: 0px;padding: 0px\">\"-c\"<\/span>,<span style=\"margin: 0px;padding: 0px\">\"while true; do cat \/var\/log\/nginx\/access.log \/var\/log\/nginx\/error.log; sleep 30; done\"<\/span>]<br>      <span style=\"margin: 0px;padding: 0px\">volumeMounts<\/span>:          <span style=\"margin: 0px;padding: 0px\">#\u5bb9\u5668\u518d\u6302\u8f7d\u8fd9\u4e2avolume<\/span><br>        <span style=\"margin: 0px;padding: 0px\">-<\/span> <span style=\"margin: 0px;padding: 0px\">name<\/span>: <span style=\"margin: 0px;padding: 0px\">shared<\/span><span style=\"margin: 0px;padding: 0px\">-<\/span><span style=\"margin: 0px;padding: 0px\">logs<\/span><br>          <span style=\"margin: 0px;padding: 0px\">mountPath<\/span>: <span style=\"margin: 0px;padding: 0px\">\/var\/<\/span><span style=\"margin: 0px;padding: 0px\">log<\/span><span style=\"margin: 0px;padding: 0px\">\/<\/span><span style=\"margin: 0px;padding: 0px\">nginx<\/span><\/pre>\n<h2>03\u5bb9\u5668\u8bbe\u8ba1\u6a21\u5f0f<\/h2>\n<\/p>\n<p>Kubernetes \u793e\u533a\u7ed3\u5408\u4e86Kubernetes \u96c6\u7fa4\u7684\u5fae\u670d\u52a1\u6a21\u578b\u63d0\u51fa\u4e86\u4e00\u7cfb\u5217\u89e3\u51b3\u5178\u578b\u5206\u5e03\u5f0f\u7cfb\u7edf\u95ee\u9898\u7684\u5bb9\u5668\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u4e3b\u8981\u53ef\u4ee5\u5206\u4e09\u5927\u7c7b\uff1a<\/p>\n<p style=\"text-align: justify\">\n<ul>\n<li>\u5355\u5bb9\u5668\u7ba1\u7406\u6a21\u5f0f\uff1b<\/li>\n<li>\u5355\u8282\u70b9\u591a\u5bb9\u5668\u6a21\u5f0f\uff1b<\/li>\n<li>\u591a\u8282\u70b9\u591a\u5bb9\u5668\u6a21\u5f0f\u3002<\/li>\n<\/ul>\n<p style=\"text-align: justify\">\n<h3>3.1 \u5355\u5bb9\u5668\u7ba1\u7406\u6a21\u5f0f<\/h3>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">Kubernetes \u5bb9\u5668\u8bbe\u8ba1\u6a21\u5f0f\u4e2d\uff0c\u5355\u5bb9\u5668\u7ba1\u7406\u6a21\u5f0f\u662f\u6700\u7b80\u5355\u7684\uff0c\u5355\u5355\u542f\u52a8\u4e00\u4e2a\u5355\u5bb9\u5668\u5fae\u670d\u52a1\u5b9e\u4f8b\u547d\u4ee4\u4e0eDocker\u539f\u751f\u547d\u4ee4\u7c7b\u4f3c\u3002<\/p>\n<p style=\"text-align: justify\">\n<pre>$ kubectl run nginx --image=nginx:latest -n qiuqiu<br>pod\/nginx created<br><br>$ kubectl get all -n qiuqiu<br>NAME        READY   STATUS    RESTARTS   AGE<br>pod\/nginx   1\/1     Running   0          9s<\/pre>\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<p style=\"text-align: justify\">\n<h3>3.2 \u5355\u8282\u70b9\u591a\u5bb9\u5668\u6a21\u5f0f<\/h3>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u5728\u79c9\u6301\u5173\u6ce8\u70b9\u5206\u79bb\u539f\u5219\uff08SOC)\u4e0b\uff0c\u5bb9\u5668\u5316\u5e94\u7528\u7a0b\u5e8f\u662f\u5bb9\u5668\u4e4b\u95f4\u7684\u804c\u8d23\u5206\u79bb\uff0c\u6bcf\u4e2a\u5bb9\u5668\u90fd\u5e94\u8be5\u53ea\u627f\u62c5\u5b83\u6700\u64c5\u957f\u4e1a\u52a1\uff0c\u5176\u4ed6\u989d\u5916\u7684\u4efb\u52a1\uff0c\u5e94\u8be5\u4ea4\u7ed9\u5176\u4ed6\u5bb9\u5668\uff08Sidecar \u5bb9\u5668\uff09\uff0c\u5355\u8282\u70b9\u591a\u5bb9\u5668\u6a21\u5f0f\u4fbf\u662f\u5229\u7528\u4e86Kubernetes \u4e2dPod\u5185\u6240\u6709\u5bb9\u5668\u53ef\u4ee5\u5171\u4eab\u540c\u4e00\u4e2a\u5b58\u50a8\u7a7a\u95f4\uff08Volume\uff09\u548c\u7f51\u7edc\u5730\u5740\u7a7a\u95f4\uff08Network Namespace\uff09\u7279\u6027\uff0c\u6765\u5145\u5206\u4f53\u73b0SOC\u539f\u5219\u3002<\/p>\n<p style=\"text-align: justify\">\n<h4>3.2.1 \u630e\u6597\u6a21\u5f0f\uff08Sidecar Pattern\uff09<\/h4>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u630e\u6597\u6a21\u5f0f\u4e3b\u8981\u662f\u5229\u7528\u5728\u540c\u4e00\u4e2aPod\u4e2d\u7684\u5bb9\u5668\u53ef\u4ee5\u5171\u4eab\u5b58\u50a8\u7684\u80fd\u529b\u3002\u5982\u4e0b\u56fe\u5e94\u7528\u65e5\u5fd7\u6536\u96c6\u670d\u52a1\u573a\u666f\uff1a\u5bf9\u4e8e\u5e94\u7528\u670d\u52a1A\uff08\u5982\uff1aNginx\uff09\u6765\u8bf4\uff0c\u91cd\u5fc3\u5e76\u975e\u65e5\u5fd7\u7684\u6301\u4e45\u5316\u5b58\u50a8\u4e0e\u7ba1\u7406\uff08access.log\u7b49)\uff0c\u800c\u8fd0\u7ef4\u4eba\u5458\u6709\u65f6\u4f1a\u9700\u8981\u901a\u8fc7\u65e5\u5fd7\u6392\u67e5\u670d\u52a1\u5f02\u5e38\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u65e5\u5fd7\u6536\u96c6\u5668\u670d\u52a1\u662f\u4e00\u4e2a\u5f88\u6709\u5fc5\u8981\u7684\u8f85\u52a9\u5de5\u5177\u3002\u79c9\u6301\u5173\u6ce8\u70b9\u5206\u79bb\u539f\u5219\uff08SOC)\uff0c\u53ef\u4ee5\u4e3a\u5e94\u7528\u670d\u52a1\u7684Pod\u4e2d\u52a0\u5165\u4e00\u4e2a\u65e5\u5fd7\u6536\u96c6\u5668\u670d\u52a1\u7684Sidecar \u5bb9\u5668\uff0c\u5e94\u7528\u670d\u52a1\u5bb9\u5668\u4f5c\u4e3a\u4e3b\u5bb9\u5668\u53ea\u9700\u5173\u6ce8\u4e1a\u52a1\uff0c\u65e5\u5fd7\u4fe1\u606f\u7531Sidecar \u5bb9\u5668\u8fdb\u884c\u6536\u96c6\u5904\u7406\u3002\u751f\u4ea7\u73af\u5883\u4e2d\u53ef\u4ee5\u4f7f\u7528Filebeat \u6216\u8005 Logstash \u7b49\u5de5\u5177\u6536\u96c6\u65e5\u5fd7\u5e76\u5206\u53d1\u7ed9ElasticSearch\u96c6\u7fa4\u3002\u630e\u6597\u6a21\u5f0f\u4e0b\uff0c\u901a\u5e38\u4f5c\u4e3a\u8f85\u52a9\u5de5\u5177\u7684Sidecar \u5bb9\u5668\u955c\u50cf\u662f\u6807\u51c6\u5316\u53ef\u91cd\u7528\u7684\uff0c\u5e94\u7528\u670d\u52a1\u4e0d\u9700\u8981\u6bcf\u6b21\u90fd\u5e26\u7740\u8f85\u52a9\u5de5\u5177\u7684\u6267\u884c\u6587\u4ef6\u4e00\u8d77\u6253\u5305\u8fed\u4ee3\u5347\u7ea7\u3002<\/p>\n<p style=\"text-align: justify\">\n<p style=\"text-align: center\">\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u4ee5\u4e0byaml\u6587\u4ef6\u5b9a\u4e49\u4e86\u4e00\u4e2aPod\u5185\uff0c\u542f\u52a82\u4e2a\u5bb9\u5668\uff08\u4e0d\u5305\u542b\u57fa\u7840\u5bb9\u5668\uff09\uff0c\u5e76\u4f7f\u7528emptyDir\u5377\u4f5c\u4e3a\u5171\u4eab\u5b58\u50a8\u3002Sidecar \u5bb9\u5668\u901a\u5e38\u5728\u5b9a\u4e49\u4e2d\u6392\u5728\u7b2c\u4e8c\u4f4d\uff0c\u56e0\u6b64\u5728\u6267\u884c kubectl \u547d\u4ee4\u65f6\uff0c\u9ed8\u8ba4\u76ee\u6807\u662f\u4e3b\u5bb9\u5668\u3002Nginx \u670d\u52a1\u4f5c\u4e3a\u4e3b\u5bb9\u5668\uff0c\u4ea7\u751f\u7684\u65e5\u5fd7\u5199\u5165\u5171\u4eab\u5b58\u50a8\u5377\u6302\u8f7d\u7684\/var\/log\/nginx\u76ee\u5f55\u3002\u8fd9\u6837\u53ef\u4ee5\u963b\u6b62\u539f\u672c\u5c06Nginx \u670d\u52a1\u65e5\u5fd7\u4ee5\u5bb9\u5668\u6807\u51c6\u5316\u8f93\u51fa\u5f62\u5f0f\u8f93\u51fa\uff08\u5373\u963b\u6b62\u88ab\u8f6f\u8fde\u63a5\u5230\/dev\/stdout\u548c\/dev\/stderr\uff0c\u8f93\u51fa\u5230\u4e86\u5bb9\u5668\u7684\u524d\u53f0\u65e5\u5fd7\uff09\uff0c\u5e76\u5199\u5165access.log \u4e0e error.log \u6587\u4ef6\u3002\u6700\u540e\u7531Sidecar\u5bb9\u5668\uff08busybox\uff09\u8fdb\u884c\u76f8\u5173\u65e5\u5fd7\u5904\u7406\u3002<\/p>\n<p style=\"text-align: justify\">\n<pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: app-log-aggregation-server<br>spec:<br>  volumes:<br>    - name: shared-logs<br>      emptyDir: {}<br>  containers:<br>    - name: nginx<br>      image: nginx<br>      volumeMounts:<br>        - name: shared-logs<br>          mountPath: \/var\/log\/nginx<br>    - name: sidecar-container<br>      image: busybox<br>      command: [\"sh\",\"-c\",\"while true; do cat \/var\/log\/nginx\/access.log \/var\/log\/nginx\/error.log; sleep 30; done\"]<br>      volumeMounts:<br>        - name: shared-logs<br>          mountPath: \/var\/log\/nginx<\/pre>\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<p style=\"text-align: justify\">\n<h4>3.2.2 \u5916\u4ea4\u5b98\u6a21\u5f0f(Ambassador Pattern)<\/h4>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u5916\u4ea4\u5b98\u6a21\u5f0f\u4e3b\u8981\u662f\u5229\u7528\u540c\u4e00\u4e2aPod\u4e2d\u7684\u5bb9\u5668\u53ef\u4ee5\u5171\u4eab\u7f51\u7edc\u5730\u5740\u7a7a\u95f4\u7684\u7279\u6027\u3002\u5916\u4ea4\u5b98\u6a21\u5f0f\u4e2d\u5b58\u5728\u4e00\u4e2a\u8d1f\u8d23\u4ee3\u7406\u4ece\u5e94\u7528\u7a0b\u5e8f\u5bb9\u5668\u5230\u5176\u4ed6\u670d\u52a1\u7684\u8fde\u63a5\u7684\u8fb9\u8f66\u5bb9\u5668\uff08SideCar container \uff09\uff0c\u4e5f\u79f0\u4e3a\u5916\u4ea4\u5b98\u5bb9\u5668\u3002\u4f8b\u5982\uff0c\u51e0\u4e4e\u6240\u6709\u5e94\u7528\u7a0b\u5e8f\u5728\u67d0\u4e2a\u9636\u6bb5\u90fd\u9700\u8981\u6570\u636e\u5e93\u8fde\u63a5\u3002\u9488\u5bf9\u5e94\u7528\u5f00\u53d1\u8fed\u4ee3\u4e2d\u4f1a\u5b58\u5728\u591a\u79cd\u73af\u5883\u6570\u636e\u5e93\u2014\u2014\u4e00\u4e2a\u5f00\u53d1\u6570\u636e\u5e93\u3001\u4e00\u4e2a\u6d4b\u8bd5\u6570\u636e\u5e93\u548c\u4e00\u4e2a\u751f\u4ea7\u6570\u636e\u5e93\u3002\u5728\u7f16\u5199\u5e94\u7528\u7a0b\u5e8f\u7684 Pod \u65f6\uff0c\u5f00\u53d1\/\u5b9e\u65bd\u4eba\u5458\u9700\u8981\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u6216 configMap \u66f4\u6539\u6570\u636e\u5e93\u8fde\u63a5\u914d\u7f6e\u9879\u8fbe\u5230\u6570\u636e\u5e93\u7684\u5207\u6362\u3002\u800c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5916\u4ea4\u5b98\u6a21\u5f0f\uff0c\u6839\u636e\u8fd0\u884c\u7684\u73af\u5883\u5c06\u6570\u636e\u5e93\u8fde\u63a5\u4ee3\u7406\u5230\u76f8\u5e94\u7684\u6570\u636e\u5e93\u3002\u5f00\u53d1\/\u5b9e\u65bd\u4eba\u5458\u65e0\u9700\u4fee\u6539\u914d\u7f6e\u9879\uff08\u548c\u4f7f\u7528\u5f00\u53d1\u73af\u5883\u6570\u636e\u5e93\u914d\u7f6e\u9879\u4e00\u6837)\uff0c\u5f53\u90e8\u7f72\u5230\u6d4b\u8bd5\u6216\u751f\u4ea7\u73af\u5883\u65f6\uff0c\u5916\u4ea4\u5b98\u5bb9\u5668\u4f1a\u68c0\u6d4b\u5b83\u5728\u54ea\u4e2a\u73af\u5883\u4e0a\u8fd0\u884c\uff08\u4f8b\u5982\u53cd\u5c04\u65b9\u5f0f\uff09\uff0c\u5e76\u8fde\u63a5\u5230\u6b63\u786e\u7684\u6570\u636e\u5e93\u4e0a\u3002<\/p>\n<p style=\"text-align: justify\">\n<p style=\"text-align: center\">\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u4ee5\u4e0byaml\u7ed9\u51fa\u4e00\u4e2aRedis\u5ba2\u6237\u7aef\u8bbf\u95ee\u4e0d\u540c\u73af\u5883Redis\u5e93\u6837\u4f8b\u3002\u4e3b\u5bb9\u5668\u662f\u7531redis\u5ba2\u6237\u7aef\u670d\u52a1\uff0c\u5916\u4ea4\u5b98\u5bb9\u5668\u662f\u57fa\u4e8emalexer\/twemproxy \u955c\u50cf\u542f\u52a8\u7684\u5bb9\u5668\uff0c\u63d0\u4f9b\u4e2d\u7ee7\u94fe\u63a5Redis\u6570\u636e\u670d\u52a1\u3002\u9700\u8981\u8bf4\u660e\u7684malexer\/twemproxy \u955c\u50cf\u9700\u8981\u5c06Redis \u5b9e\u4f8b\u4ee5\u73af\u5883\u53d8\u91cf\u4f20\u9012\uff0813-15\u884c\uff09\uff0c\u683c\u5f0f\u4e3aaddress:port:weight\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8be5\u5bb9\u5668\u4fa6\u542c\u7aef\u53e3 6380\uff08\u5176\u4ed6\u9ad8\u7ea7\u914d\u7f6e\u53ef\u67e5\u9605github\uff1ahttps:\/\/github.com\/malexer\/docker-twemproxy\uff09\u3002&nbsp;<\/p>\n<p style=\"text-align: justify\">\n<pre># Redis client yaml<br>apiVersion: v1<br>kind: Pod<br>metadata:<br>  namespace: qiuqiu<br>  name: ambassador-example<br>spec:<br>  containers:<br>  - name: redis-client<br>    image: redis<br>  - name: ambassador<br>    image: malexer\/twemproxy<br>    env:<br>    - name: REDIS_SERVERS<br>      value: redis-st-0.redis-svc.qiuqiu.svc.cluster.local:6379:1<br>    ports:<br>    - containerPort: 6380<\/pre>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u4ee5\u4e0b\u56fe\uff0c\u6f14\u793a\u4e86\u5e94\u7528\u7a0b\u5e8f\uff08\u7531 Redis \u5ba2\u6237\u7aef\u6a21\u62df\uff09\u5411 localhost:6380 \u53d1\u8d77\u8bf7\u6c42\uff0c\u5916\u4ea4\u5b98\u5bb9\u5668\u63a5\u6536\u8bf7\u6c42\u5e76\u5c06\u5176\u4e2d\u8f6c\u5230\u5176\u914d\u7f6e\u4e2d\u5b9a\u4e49\u7684 Redis \u670d\u52a1\u5668\u3002<\/p>\n<p style=\"text-align: justify\">\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<h4>3.2.3 \u9002\u914d\u5668\u6a21\u5f0f\uff08Adapter Pattern\uff09<\/h4>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u9002\u914d\u5668\u6a21\u5f0f\u4e3b\u8981\u662f\u4ee5\u6807\u51c6\u5316\u548c\u89c4\u8303\u5316\u5e94\u7528\u5bf9\u5916\u66b4\u9732\u670d\u52a1\u63a5\u53e3\u3002\u6bcf\u4e2a\u5e94\u7528\u7a0b\u5e8f\u53ef\u80fd\u4f1a\u4ee5\u5404\u79cd\u5f62\u5f0f\uff08\u5982JSON\u3001XML\u3001StatsD\u7b49\uff09\uff0c\u5bf9\u5916\u8f93\u51fa\u76d1\u63a7\u6307\u6807\u6570\u636e\u3002\u7136\u800c\uff0c\u76d1\u63a7\u7cfb\u7edf\u5374\u5e0c\u671b\u6536\u5230\u7684\u662f\u7edf\u4e00\u6570\u636e\u6a21\u578b\u7684\u6570\u636e\u3002\u8fd9\u65f6\u5c31\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u9002\u914d\u5668\u6a21\u5f0f\uff0c\u5c06\u5e94\u7528\u7a0b\u5e8f\u5bb9\u5668\uff0c\u540c\u76f8\u5e94\u7684\u76d1\u63a7\u6307\u6807\u6570\u636e\u8f6c\u6362\u7684\u9002\u914d\u5668\u5bb9\u5668\u521b\u5efa\u5728\u540c\u4e00\u4e2aPod\u5185\uff0c\u5c31\u53ef\u505a\u5230\u5c06\u4e0d\u540c\u5e94\u7528\u7684\u5f02\u6784\u76d1\u63a7\u6307\u6807\u6570\u636e\u8f6c\u6362\u4e3a\u5355\u4e2a\u7edf\u4e00\u6a21\u578b\u6570\u636e\u3002<\/p>\n<p style=\"text-align: justify\">\n<p style=\"text-align: center\">\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u4ee5\u4e0byaml\u662f\u4ee5Prometheus \u76d1\u63a7Nginx \u670d\u52a1\u72b6\u6001\u6307\u6807\u4e3a\u4f8b\u3002Nginx \u6709\u4e00\u4e2a\u7528\u4e8e\u67e5\u8be2 Web \u670d\u52a1\u5668\u72b6\u6001\u7684\u63a5\u53e3\uff0c\u53ea\u8981\u66f4\u6539 default.conf \u6587\u4ef6\u914d\u7f6e\u9879\u5373\u53ef\u542f\u7528\u3002\u63a5\u7740\u6dfb\u52a0\u4e00\u4e2a\u9002\u914d\u5668\u5bb9\u5668\u5c06\u6b64\u63a5\u53e3\u7684\u8f93\u51fa\u8f6c\u6362\u4e3a Prometheus \u6240\u9700\u7684\u6570\u636e\u683c\u5f0f\u5373\u53ef\u3002\u901a\u8fc7configMap \u914d\u7f6e default.conf \u6587\u4ef6\u5185\u5bb9\uff0c\u5176\u4e2d\uff0820-24\u884c\uff09\u5b9a\u4e49\u4e86\u4e00\u4e2a\u63a5\u53e3\uff08\/nginx_status\uff09\uff0c\u5b83\u5229\u7528 stub_status \u6a21\u5757\u6765\u663e\u793a Nginx \u72b6\u6001\u4fe1\u606f\uff1b\u63a5\u7740\u662f\u521b\u5efa\u5305\u542bNginx \u5bb9\u5668\u548c\u9002\u914d\u5668\u5bb9\u5668\u7684Pod\u3002\u9002\u914d\u5668\u5bb9\u5668\u4f7f\u7528 nginx\/nginx-prometheus-exporter\u955c\u50cf\u521b\u5efa\uff0c\u5b83\u53ef\u4ee5\u6309\u7167 Prometheus \u683c\u5f0f\u8f6c\u6362 Nginx \u5728 \/nginx_status \u63a5\u53e3\u66b4\u9732\u7684\u6307\u6807\u6570\u636e\u683c\u5f0f\u3002<\/p>\n<p style=\"text-align: justify\">\n<pre># Nginx config<br>apiVersion: v1<br>kind: ConfigMap<br>metadata:<br>  namespace: qiuqiu<br>  name: nginx-conf<br>data:<br>  default.conf: |<br>    server {<br>      listen       80;<br>      server_name  localhost;<br>      location \/ {<br>          root   \/usr\/share\/nginx\/html;<br>          index  index.html index.htm;<br>      }<br>      error_page   500 502 503 504  \/50x.html;<br>      location = \/50x.html {<br>          root   \/usr\/share\/nginx\/html;<br>      }<br>      location \/nginx_status {<br>        stub_status;<br>        allow 127.0.0.1;  #only allow requests from localhost<br>        deny all;   #deny all other hosts <br>      }<br>    }<br><br><br><br><br># Nginx Pod and the adapter container<br>apiVersion: v1<br>kind: Pod<br>metadata: <br>  namespace: qiuqiu<br>  name: webserver<br>spec:<br>  volumes:<br>  - name: nginx-conf<br>    configMap:<br>      name: nginx-conf<br>      items:<br>      - key: default.conf<br>        path: default.conf<br>  containers:<br>  - name: webserver<br>    image: nginx<br>    ports:<br>    - containerPort: 80<br>    volumeMounts:<br>    - mountPath: \/etc\/nginx\/conf.d<br>      name: nginx-conf<br>      readOnly: true<br>  - name: adapter<br>    image: nginx\/nginx-prometheus-exporter:0.4.2<br>    args: [\"-nginx.scrape-uri\",\"http:\/\/localhost\/nginx_status\"]<br>    ports:<br>    - containerPort: 9113<\/pre>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u4ee5\u4e0b\u56fe\u662f\u9a8c\u8bc1\u64cd\u4f5c\uff1a\u6267\u884cyaml\u521b\u5efa\u670d\u52a1\u540e\uff0c\u9996\u5148\u767b\u5f55\u5230 webserver Pod\uff0c\u5b89\u88c5 curl \u6307\u4ee4\uff08\u4fbf\u4e8e\u53d1\u8d77 HTTP \u8bf7\u6c42\uff09\uff0c\u63a5\u7740\uff0c\u68c0\u67e5 \/nginx_status \u63a5\u53e3\u548c\u9002\u914d\u5668\u5bb9\u5668\u7684\u8f6c\u6362\u63a5\u53e3\uff089113\/metrics \uff09\u3002<\/p>\n<p style=\"text-align: justify\">\n<p style=\"text-align: center\">\n<p style=\"text-align: center\">\n<p style=\"text-align: justify\">\n<h3>3.3 \u591a\u8282\u70b9\u591a\u5bb9\u5668\u6a21\u5f0f<\/h3>\n<p style=\"text-align: justify\">\n<h4>3.3.1 \u9009\u4e3e\u6a21\u5f0f\uff08Election Pattern\uff09<\/h4>\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u9009\u4e3e\u6a21\u5f0f\u662f\u4e00\u79cd\u591a\u8282\u70b9\u591a\u5bb9\u5668\u7ec4\u5408\u6a21\u5f0f\uff0c\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u5c24\u4e3a\u91cd\u8981\u3002\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u6709\u72b6\u6001\u5e94\u7528\u670d\u52a1\u6765\u8981\u89e3\u51b3\u9ad8\u53ef\u7528\u548c\u6c34\u5e73\u4f38\u7f29\u95ee\u9898\u65f6\uff0c\u9700\u8981\u4f9d\u8d56\u5916\u90e8\u7cfb\u7edf\u5b58\u50a8\u6bcf\u4e2a\u5b9e\u4f8b\u4e0e\u72b6\u6001\u5206\u7247\u6570\u636e\u7684\u5bf9\u5e94\u5173\u7cfb\uff08\u5168\u5c40\u4fe1\u606f\uff09\u3002\u800c\u5f15\u5165\u9009\u4e3e\u4e3b\u63a7\u8282\u70b9\u673a\u5236\uff0c\u5c31\u4e0d\u9700\u8981\u4f9d\u8d56\u5916\u90e8\u7684\u7cfb\u7edf\u6765\u7ef4\u62a4\u81ea\u5df1\u7684\u72b6\u6001\u4e86\uff0c\u7531\u4e3b\u63a7\u8282\u70b9\u5b8c\u6210\u4fdd\u5b58\u548c\u5206\u53d1\u5168\u5c40\u4fe1\u606f\u4efb\u52a1\u2014\u2014\u5c06\u5e94\u7528\u670d\u52a1\u5bb9\u5668\u4e0e\u53ef\u590d\u7528\u7684\u9009\u4e3e\u5668\u5bb9\u5668\u7ec4\u5408\u8d77\u6765\u4f7f\u7528\u2014\u2014\u5373\u9009\u4e3e\u6a21\u5f0f\u3002<\/p>\n<p style=\"text-align: justify\">\n<p style=\"text-align: center\">\n<\/p>\n<p style=\"text-align: justify\">\u4ee5\u4e0byaml\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7528\u6765\u4f5c\u4e3a\u5e94\u7528\u5bb9\u5668\u68c0\u6d4b\u9009\u4e3e\u7ed3\u679c\u7684nodejs\u670d\u52a1\uff08\u5177\u4f53\u53c2\u8003Kubernetes\u793e\u533acontrib\u9879\u76eeelection\uff08https:\/\/github.com\/kubernetes\/contrib\/tree\/master\/election\uff09\uff09<\/p>\n<p style=\"text-align: justify\">\n<pre>apiVersion: apps\/v1<br>kind: Deployment<br>metadata:<br>  name: demo-elector-nodejs<br>  namespace: qiuqiu<br>spec:<br>  replicas: 3<br>  selector:<br>    matchLabels:<br>      name: leader-elector<br>  template:<br>    metadata:<br>      labels:<br>        name: leader-elector<br>    spec:<br>      containers:<br>      - image: k8s.gcr.io\/nodejs-election-client:0.1<br>        imagePullPolicy: IfNotPresent<br>        name: nodejs<br>        ports:<br>        - containerPort: 8080<br>          protocol: TCP<br>        resources:<br>          requests:<br>            cpu: 100m<br>      - image: k8s.gcr.io\/leader-elector:0.5<br>        imagePullPolicy: Always<br>        name: elector<br>        args:<br>          - --election=elect-master<br>          - --http=localhost:4040<br>        ports:<br>        - containerPort: 4040<br>          protocol: TCP<br>        resources:<br>          requests:<br>            cpu: 100m<\/pre>\n<\/p>\n<h2>04\u7efc\u8ff0<\/h2>\n<\/p>\n<p>\u4ee5\u4e0a\u7b80\u5355\u4ecb\u7ecd\u4e86\u5bb9\u5668\u548cPod\u7684\u6982\u5ff5\uff0c\u5e76\u57fa\u4e8e\u5bb9\u5668\u548cPod\u7684\u5173\u7cfb\uff0c\u5f15\u5165\u5bb9\u5668\u8bbe\u8ba1\u6a21\u5f0f\u3002\u5e76\u7ed3\u5408\u5b9e\u4f8b\u4ecb\u7ecd\u4e86\u8de8\u6597\u6a21\u5f0f\u3001\u5916\u4ea4\u5b98\u6a21\u5f0f\u3001\u9002\u914d\u5668\u6a21\u5f0f\u3001\u9009\u4e3e\u6a21\u5f0f\u3002\u4ee5\u4e0b\u5217\u8868\u662f\u5bf9\u4ee5\u4e0a\u4ecb\u7ecd\u6a21\u5f0f\u7684\u4e00\u4e2a\u7b80\u5355\u7efc\u8ff0\u3002<\/p>\n<p style=\"text-align: justify\">\n<p style=\"text-align: center\">\n<p style=\"text-align: justify\">\n<p style=\"text-align: justify\">\u9274\u4e8e\u7bc7\u5e45\u9650\u5236\uff0c\u8bf8\u5982\u5de5\u4f5c\u961f\u5217\u6a21\u5f0f\uff08Work queue pattern\uff09\u3001\u5206\u6563\u6536\u96c6\u6a21\u5f0f\uff08Scatter\/gather pattern\uff09\u7b49\u5176\u4ed6\u4f18\u79c0\u7684\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u8bfb\u8005\u53ef\u4ee5\u6309\u9700\u67e5\u8be2\u793e\u533a\u6587\u6863\uff08https:\/\/kubernetes.io\/blog\uff09\u3002<\/p>\n<p><span><\/span><br \/>\n<span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>K8s\u4e2d\u7684Pod\u548c\u5bb9\u5668\u8bbe\u8ba1\u6a21\u5f0f \u4f5c\u8005\uff1a\u79fb\u52a8Labs 2022-06-01 09:38:36 \u4e91\u8ba1\u7b97 \u5728\u88ab\u8a89\u4e3a\u4e91 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":225669,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-225668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-phone"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/225668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=225668"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/225668\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/225669"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=225668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=225668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=225668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}