{"id":100202,"date":"2025-01-03T10:25:12","date_gmt":"2025-01-03T02:25:12","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=100202"},"modified":"2025-01-03T10:25:16","modified_gmt":"2025-01-03T02:25:16","slug":"kwlyljj","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/100202.html","title":{"rendered":"K8s\u7f51\u7edc\u539f\u7406\u8bb2\u89e3"},"content":{"rendered":"\n
\u3000\u3000Kubernetes(K8s)<\/strong>\u7684\u7f51\u7edc\u539f\u7406\u662f\u5176\u6210\u529f\u7684\u5173\u952e\u4e4b\u4e00\uff0c\u6d89\u53ca\u591a\u4e2a\u5c42\u9762\u7684\u8bbe\u8ba1\u548c\u5b9e\u73b0\u3002\u4ee5\u4e0b\u662fK8s\u7f51\u7edc\u539f\u7406\u7684\u8be6\u7ec6\u8bb2\u89e3\uff1a<\/p>\n\n\n\n \u3000\u3000K8s\u7684\u7f51\u7edc\u6a21\u578b\u8bbe\u8ba1\u7684\u6838\u5fc3\u539f\u5219\u662f\u6bcf\u4e2aPod\u90fd\u62e5\u6709\u4e00\u4e2a\u72ec\u7acb\u7684IP\u5730\u5740\uff0c\u5e76\u4e14\u5047\u5b9a\u6240\u6709Pod\u90fd\u5728\u4e00\u4e2a\u53ef\u4ee5\u76f4\u63a5\u8fde\u901a\u7684\u3001\u6241\u5e73\u7684\u7f51\u7edc\u7a7a\u95f4\u4e2d\u3002\u8fd9\u79cd\u8bbe\u8ba1\u4f7f\u5f97Pod\u4e4b\u95f4\u53ef\u4ee5\u50cf\u4f20\u7edf\u865a\u62df\u673a\u6216\u7269\u7406\u673a\u4e00\u6837\u76f4\u63a5\u901a\u4fe1\uff0c\u800c\u65e0\u9700\u901a\u8fc7\u590d\u6742\u7684\u7f51\u7edc\u8f6c\u6362\u3002<\/p>\n\n\n\n \u3000\u3000Linux\u7cfb\u7edf\u4e2d\u7684\u7f51\u7edc\u547d\u540d\u7a7a\u95f4(Network Namespace)\u662f\u5b9e\u73b0\u7f51\u7edc\u9694\u79bb\u7684\u57fa\u7840\u3002\u6bcf\u4e2aPod\u8fd0\u884c\u5728\u4e00\u4e2a\u72ec\u7acb\u7684\u547d\u540d\u7a7a\u95f4\u4e2d\uff0c\u62e5\u6709\u72ec\u7acb\u7684\u7f51\u7edc\u6808\uff0c\u5305\u62ec\u63a5\u53e3\u3001\u8bbe\u5907\u3001\u8def\u7531\u8868\u548ciptables\u89c4\u5219\u3002Veth\u8bbe\u5907\u5bf9(Virtual Ethernet Pair)\u7528\u4e8e\u8fde\u63a5\u4e0d\u540c\u7684\u547d\u540d\u7a7a\u95f4\uff0c\u4f7f\u5f97Pod\u5185\u7684\u5bb9\u5668\u80fd\u591f\u5171\u4eab\u540c\u4e00\u4e2a\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\uff0c\u4ece\u800c\u5b9e\u73b0\u5bb9\u5668\u95f4\u7684\u901a\u4fe1\u3002<\/p>\n\n\n\n \u3000\u3000K8s\u672c\u8eab\u4e0d\u81ea\u5e26\u7f51\u7edc\u63a7\u5236\uff0c\u800c\u662f\u901a\u8fc7CNI\u63a5\u53e3\u4e0e\u7b2c\u4e09\u65b9\u7f51\u7edc\u63d2\u4ef6(\u5982Flannel\u3001Calico\u7b49)\u8fdb\u884c\u96c6\u6210\uff0c\u4ee5\u5b9e\u73b0Pod\u7f51\u7edc\u7684\u914d\u7f6e\u548c\u7ba1\u7406\u3002CNI\u63d2\u4ef6\u8d1f\u8d23\u5728\u521b\u5efaPod\u65f6\u81ea\u52a8\u914d\u7f6e\u7f51\u7edc\uff0c\u5305\u62ec\u521b\u5efa\u865a\u62df\u8bbe\u5907\u3001\u6302\u8f7d\u5230\u7f51\u6865\u3001\u6dfb\u52a0\u8def\u7531\u89c4\u5219\u7b49\u64cd\u4f5c\u3002<\/p>\n\n\n\n \u3000\u3000Flannel<\/p>\n\n\n\n \u3000\u3000Flannel\u662f\u4e00\u79cd\u5e38\u7528\u7684\u8986\u76d6\u7f51\u7edc\u65b9\u6848\uff0c\u901a\u8fc7\u96a7\u9053\u6280\u672f(\u5982VXLAN\u6216UDP)\u5728\u7269\u7406\u7f51\u7edc\u4e0a\u5efa\u7acb\u865a\u62df\u7f51\u7edc\u3002\u5176\u4e3b\u8981\u5b9e\u73b0\u65b9\u5f0f\u5305\u62ec\uff1a<\/p>\n\n\n\n \u3000\u3000Flannel-UDP<\/strong>\uff1a\u5df2\u88ab\u5f03\u7528\u3002<\/p>\n\n\n\n \u3000\u3000Flannel-VXLAN<\/strong>\uff1a\u4f7f\u7528VXLAN\u6280\u672f\u5c01\u88c5\u4ee5\u592a\u7f51\u5e27\uff0c\u63d0\u9ad8\u6548\u7387\u3002<\/p>\n\n\n\n \u3000\u3000Flannel-host-gw<\/strong>\uff1a\u57fa\u4e8e\u4e09\u5c42\u7f51\u7edc\uff0c\u6027\u80fd\u66f4\u4f18\uff0c\u4f46\u8981\u6c42\u5bbf\u4e3b\u673a\u5728\u4e8c\u5c42\u8fde\u901a\u3002<\/p>\n\n\n\n \u3000\u3000Calico<\/p>\n\n\n\n \u3000\u3000Calico\u91c7\u7528BGP\u534f\u8bae\u7ef4\u62a4\u4e3b\u673a\u8def\u7531\u8868\uff0c\u652f\u6301\u975eIPIP\u6a21\u5f0f\u548cIPIP\u6a21\u5f0f\uff1a<\/p>\n\n\n\n \u3000\u3000\u975eIPIP\u6a21\u5f0f<\/strong>\uff1a\u4e0d\u4f7f\u7528\u96a7\u9053\u6280\u672f\uff0c\u4f9d\u8d56\u5e95\u5c42\u7f51\u7edc\u8bbe\u5907\u3002<\/p>\n\n\n\n \u3000\u3000IPIP\u6a21\u5f0f<\/strong>\uff1a\u901a\u8fc7\u5728\u6bcf\u53f0\u5bbf\u4e3b\u673a\u4e0a\u589e\u52a0tunl0\u8bbe\u5907\uff0c\u89e3\u51b3\u8de8\u5b50\u7f51\u901a\u4fe1\u95ee\u9898\u3002<\/p>\n\n\n\n \u3000\u3000Pod\u95f4\u901a\u4fe1<\/p>\n\n\n\n \u3000\u3000\u540c\u4e00\u8282\u70b9\u4e0a\u7684Pod\u901a\u8fc7\u865a\u62df\u7f51\u6865(\u5982docker0)\u548c\u865a\u62df\u7f51\u5361(\u5982veth0)\u8fdb\u884c\u901a\u4fe1\u3002\u4e0d\u540c\u8282\u70b9\u4e0a\u7684Pod\u901a\u8fc7\u8def\u7531\u65b9\u6848\u6216\u8986\u76d6\u7f51\u7edc\u65b9\u6848\u5b9e\u73b0\u4e92\u901a\u3002<\/p>\n\n\n\n \u3000\u3000Pod\u4e0eService\u901a\u4fe1<\/p>\n\n\n\n \u3000\u3000Service\u901a\u8fc7ClusterIP\u5b9e\u73b0\u670d\u52a1\u53d1\u73b0\u548c\u8d1f\u8f7d\u5747\u8861\u3002Kube-Proxy\u8d1f\u8d23\u4fee\u6539iptables\u89c4\u5219\uff0c\u5c06\u670d\u52a1\u8bf7\u6c42\u8f6c\u53d1\u5230\u540e\u7aefPod\u3002<\/p>\n\n\n\n \u3000\u3000K8s\u901a\u8fc7Service\u6982\u5ff5\u5c06\u591a\u4e2aPod\u5305\u88c5\u6210\u4e00\u4e2a\u670d\u52a1\u5bf9\u5916\u63d0\u4f9b\u3002Service\u901a\u8fc7\u6807\u7b7e\u9009\u62e9\u5668\u5173\u8054Pod\uff0c\u5e76\u901a\u8fc7ClusterIP\u5b9e\u73b0\u670d\u52a1\u53d1\u73b0\u548c\u8d1f\u8f7d\u5747\u8861\u3002Kube-Proxy\u8d1f\u8d23\u5904\u7406\u5916\u90e8\u6d41\u91cf\u7684\u8f6c\u53d1\u548c\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n\n\n\n \u3000\u3000Kube-Proxy<\/p>\n\n\n\n \u3000\u3000Kube-Proxy\u662fK8s\u7684\u6838\u5fc3\u7ec4\u4ef6\u4e4b\u4e00\uff0c\u8d1f\u8d23\u5904\u7406\u670d\u52a1\u53d1\u73b0\u3001\u8d1f\u8f7d\u5747\u8861\u548c\u6d41\u91cf\u8f6c\u53d1\u3002\u5b83\u901a\u8fc7iptables\u6216ipvs\u5b9e\u73b0\u670d\u52a1\u8bf7\u6c42\u7684\u8f6c\u53d1\u3002<\/p>\n\n\n\n \u3000\u3000\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u4e0eiptables<\/p>\n\n\n\n \u3000\u3000K8s\u5229\u7528iptables\u89c4\u5219\u5b9e\u73b0\u7f51\u7edc\u6d41\u91cf\u7684\u8fc7\u6ee4\u548c\u8f6c\u53d1\u3002iptables\u89c4\u5219\u5305\u62ecPREROUTING\u3001FORWARD\u548cPOSTROUTING\u94fe\uff0c\u7528\u4e8e\u5904\u7406\u4e0d\u540c\u9636\u6bb5\u7684\u7f51\u7edc\u8bf7\u6c42\u3002<\/p>\n\n\n\n \u3000\u3000K8s\u7684\u7f51\u7edc\u6a21\u578b\u5177\u6709\u4ee5\u4e0b\u4f18\u52bf\uff1a<\/p>\n\n\n\n \u3000\u3000Kubernetes\u7684\u7f51\u7edc\u6a21\u578b\u901a\u8fc7CNI\u63d2\u4ef6\u4e0e\u7b2c\u4e09\u65b9\u7f51\u7edc\u63d2\u4ef6\u7684\u96c6\u6210\uff0c\u5b9e\u73b0\u4e86\u9ad8\u6548\u3001\u7075\u6d3b\u7684\u5bb9\u5668\u7f51\u7edc\u7ba1\u7406\u3002\u5176\u6838\u5fc3\u5728\u4e8e\u6bcf\u4e2aPod\u62e5\u6709\u72ec\u7acbIP\uff0c\u5e76\u901a\u8fc7\u8986\u76d6\u7f51\u7edc\u6216\u8def\u7531\u65b9\u6848\u5b9e\u73b0\u4e92\u901a\u3002\u6b64\u5916\uff0cKube-Proxy\u7b49\u7ec4\u4ef6\u8d1f\u8d23\u670d\u52a1\u53d1\u73b0\u548c\u6d41\u91cf\u8f6c\u53d1\uff0c\u786e\u4fdd\u96c6\u7fa4\u5185\u5916\u7684\u901a\u4fe1\u987a\u7545\u3002\u7406\u89e3K8s\u7684\u7f51\u7edc\u539f\u7406\u5bf9\u4e8e\u4f18\u5316\u96c6\u7fa4\u6027\u80fd\u548c\u89e3\u51b3\u5b9e\u9645\u95ee\u9898\u81f3\u5173\u91cd\u8981\u3002<\/p>\n\n\n\n \u3000\u3000\u5728Kubernetes\u7f51\u7edc\u6a21\u578b\u4e2d\uff0cVeth\u8bbe\u5907\u5bf9(Virtual Ethernet Device Pair)\u662f\u4e00\u79cd\u7528\u4e8e\u5728\u4e0d\u540c\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u4e4b\u95f4\u5efa\u7acb\u901a\u4fe1\u7684\u673a\u5236\u3002\u5177\u4f53\u5de5\u4f5c\u539f\u7406\u5982\u4e0b\uff1a<\/p>\n\n\n\n \u3000\u3000\u6210\u5bf9\u51fa\u73b0<\/strong>\uff1aVeth\u8bbe\u5907\u603b\u662f\u6210\u5bf9\u51fa\u73b0\uff0c\u901a\u5e38\u88ab\u79f0\u4e3aveth pair\u3002\u6bcf\u5bf9Veth\u8bbe\u5907\u7531\u4e24\u4e2a\u865a\u62df\u63a5\u53e3\u7ec4\u6210\uff0c\u5f62\u6210\u4e00\u4e2a\u53cc\u5411\u7684\u6570\u636e\u901a\u9053\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u5bf9Veth\u8bbe\u5907\u65f6\uff0c\u53ef\u4ee5\u6307\u5b9a\u540d\u79f0\u5982veth0\u548cveth1.\u8fd9\u4e24\u4e2a\u8bbe\u5907\u4f1a\u81ea\u52a8\u8fde\u63a5\u5728\u4e00\u8d77\u3002<\/p>\n\n\n\n \u3000\u3000\u8fde\u63a5\u4e0d\u540c\u547d\u540d\u7a7a\u95f4<\/strong>\uff1aVeth\u8bbe\u5907\u7684\u4e00\u7aef\u901a\u5e38\u8fde\u63a5\u5230\u4e00\u4e2a\u7f51\u7edc\u547d\u540d\u7a7a\u95f4(\u5982\u5bbf\u4e3b\u673a\u7684root\u547d\u540d\u7a7a\u95f4)\uff0c\u53e6\u4e00\u7aef\u8fde\u63a5\u5230\u53e6\u4e00\u4e2a\u7f51\u7edc\u547d\u540d\u7a7a\u95f4(\u5982\u67d0\u4e2aPod\u7684\u547d\u540d\u7a7a\u95f4)\u3002\u8fd9\u79cd\u8fde\u63a5\u65b9\u5f0f\u4f7f\u5f97\u4e24\u4e2a\u539f\u672c\u9694\u79bb\u7684\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u53ef\u4ee5\u901a\u8fc7Veth\u8bbe\u5907\u8fdb\u884c\u901a\u4fe1\u3002<\/p>\n\n\n\n \u3000\u3000\u6570\u636e\u4f20\u8f93\u673a\u5236<\/strong>\uff1a\u5f53\u4e00\u7aef\u7684Veth\u8bbe\u5907\u53d1\u9001\u6570\u636e\u65f6\uff0c\u6570\u636e\u4f1a\u88ab\u76f4\u63a5\u8f6c\u53d1\u5230\u53e6\u4e00\u7aef\u7684Veth\u8bbe\u5907\uff0c\u5e76\u89e6\u53d1\u5176\u63a5\u6536\u64cd\u4f5c\u3002\u8fd9\u79cd\u673a\u5236\u7c7b\u4f3c\u4e8e\u4e00\u6839\u76f4\u8fde\u7684\u7f51\u7ebf\uff0c\u786e\u4fdd\u6570\u636e\u5305\u80fd\u591f\u5728\u4e24\u4e2a\u547d\u540d\u7a7a\u95f4\u4e4b\u95f4\u9ad8\u6548\u4f20\u8f93\u3002<\/p>\n\n\n\n \u3000\u3000\u914d\u7f6e\u4e0e\u7ba1\u7406<\/strong>\uff1a\u521b\u5efaVeth\u8bbe\u5907\u5bf9\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177\u5982ip link\u6765\u67e5\u770b\u548c\u7ba1\u7406\u8fd9\u4e9b\u8bbe\u5907\u3002\u4f8b\u5982\uff0c\u4f7f\u7528ip link add veth0 type veth peer name veth1\u547d\u4ee4\u521b\u5efa\u4e00\u5bf9Veth\u8bbe\u5907\uff0c\u5e76\u901a\u8fc7ip link show\u547d\u4ee4\u67e5\u770b\u5176\u72b6\u6001\u3002<\/p>\n\n\n\n \u3000\u3000\u5e94\u7528\u573a\u666f<\/strong>\uff1aVeth\u8bbe\u5907\u5bf9\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5bb9\u5668\u7f51\u7edc\u3001\u7f51\u7edc\u9694\u79bb\u548c\u7f51\u7edc\u529f\u80fd\u6d4b\u8bd5\u7b49\u573a\u666f\u3002\u5728Kubernetes\u96c6\u7fa4\u4e2d\uff0cVeth\u8bbe\u5907\u7528\u4e8e\u8fde\u63a5\u4e0d\u540cPod\u7684\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\uff0c\u5b9e\u73b0Pod\u4e4b\u95f4\u7684\u901a\u4fe1\u3002\u6b64\u5916\uff0cVeth\u8bbe\u5907\u8fd8\u53ef\u4ee5\u7528\u4e8e\u8fde\u63a5\u5bbf\u4e3b\u673a\u4e0e\u5bb9\u5668\u3001\u6865\u63a5\u8bbe\u5907(Bridge)\u548cOpen vSwitch(OVS)\u7b49\uff0c\u6784\u5efa\u590d\u6742\u7684\u865a\u62df\u7f51\u7edc\u62d3\u6251\u67b6\u6784\u3002<\/p>\n\n\n\n \u3000\u3000\u603b\u4e4b\uff0cVeth\u8bbe\u5907\u5bf9\u662fKubernetes\u7f51\u7edc\u6a21\u578b\u4e2d\u5b9e\u73b0\u4e0d\u540c\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u4e4b\u95f4\u901a\u4fe1\u7684\u5173\u952e\u6280\u672f\u3002<\/p>\n\n\n\n \u3000\u3000CNI(Container Network Interface)\u63d2\u4ef6\u5728Kubernetes\u7f51\u7edc\u914d\u7f6e\u4e2d\u626e\u6f14\u7740\u81f3\u5173\u91cd\u8981\u7684\u89d2\u8272\uff0c\u5176\u5177\u4f53\u4f5c\u7528\u548c\u5b9e\u73b0\u673a\u5236\u5982\u4e0b\uff1a<\/p>\n\n\n\n \u3000\u3000\u521b\u5efa\u865a\u62df\u7f51\u5361<\/strong>\uff1aCNI\u63d2\u4ef6\u8d1f\u8d23\u4e3a\u6bcf\u4e2aPod\u521b\u5efa\u865a\u62df\u7f51\u5361(\u5982veth\u5bf9)\uff0c\u5e76\u5c06\u4e00\u7aef\u8fde\u63a5\u5230Pod\u7684\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\uff0c\u53e6\u4e00\u7aef\u8fde\u63a5\u5230\u5bbf\u4e3b\u673a\u7684\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u3002<\/p>\n\n\n\n \u3000\u3000\u5206\u914dIP\u5730\u5740<\/strong>\uff1a\u901a\u8fc7\u8c03\u7528IP\u5730\u5740\u7ba1\u7406(IPAM)\u63d2\u4ef6\uff0cCNI\u63d2\u4ef6\u4e3a\u6bcf\u4e2aPod\u5206\u914d\u552f\u4e00\u7684IP\u5730\u5740\uff0c\u786e\u4fdd\u96c6\u7fa4\u5185\u5730\u5740\u4e0d\u51b2\u7a81\u3002<\/p>\n\n\n\n \u3000\u3000\u8bbe\u7f6e\u8def\u7531\u89c4\u5219<\/strong>\uff1aCNI\u63d2\u4ef6\u4f1a\u6839\u636e\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\uff0c\u4e3a\u5bb9\u5668\u8bbe\u7f6e\u5fc5\u8981\u7684\u8def\u7531\u89c4\u5219\uff0c\u786e\u4fdd\u5bb9\u5668\u4e4b\u95f4\u4ee5\u53ca\u5bb9\u5668\u4e0e\u5916\u90e8\u4e16\u754c\u7684\u8fde\u901a\u6027\u3002<\/p>\n\n\n\n \u3000\u3000\u5b9e\u73b0\u7f51\u7edc\u9694\u79bb<\/strong>\uff1a\u4e0d\u540c\u7684CNI\u63d2\u4ef6\u53ef\u4ee5\u63d0\u4f9b\u4e0d\u540c\u7684\u7f51\u7edc\u9694\u79bb\u7b56\u7565\uff0c\u5982Calico\u57fa\u4e8eBGP\u7684\u7f51\u7edc\u7b56\u7565\uff0cFlannel\u4f7f\u7528VXLAN\u6216UDP\u5c01\u88c5\u7b49\u3002<\/p>\n\n\n\n \u3000\u3000\u63d2\u4ef6\u5316\u8bbe\u8ba1<\/strong>\uff1aCNI\u63d2\u4ef6\u9075\u5faa\u4e00\u7ec4\u6807\u51c6\u5316\u7684\u63a5\u53e3\u89c4\u8303\uff0c\u5141\u8bb8\u4e0d\u540c\u4f9b\u5e94\u5546\u6216\u5f00\u53d1\u8005\u63d0\u4f9b\u5404\u81ea\u7684\u7f51\u7edc\u63d2\u4ef6\u3002\u8fd9\u4e9b\u63d2\u4ef6\u901a\u8fc7\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\u6765\u8fdb\u884c\u7f51\u7edc\u914d\u7f6e\u3002<\/p>\n\n\n\n \u3000\u3000\u751f\u547d\u5468\u671f\u7ba1\u7406<\/strong>\uff1a\u5f53Kubernetes\u521b\u5efa\u6216\u5220\u9664Pod\u65f6\uff0ckubelet\u4f1a\u8c03\u7528\u76f8\u5e94\u7684CNI\u63d2\u4ef6\u6765\u914d\u7f6e\u6216\u91ca\u653e\u7f51\u7edc\u8d44\u6e90\u3002\u5177\u4f53\u64cd\u4f5c\u5305\u62ec\u6dfb\u52a0\u3001\u68c0\u67e5\u548c\u5220\u9664\u7f51\u7edc\u914d\u7f6e\u7b49\u3002<\/p>\n\n\n\n \u3000\u3000\u7f51\u7edc\u547d\u540d\u7a7a\u95f4<\/strong>\uff1aCNI\u63d2\u4ef6\u64cd\u4f5c\u4e8eLinux\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u5c42\u9762\uff0c\u4e3a\u5bb9\u5668\u521b\u5efa\u5e76\u914d\u7f6e\u865a\u62df\u7f51\u7edc\u63a5\u53e3\u8bbe\u5907\uff0c\u5e76\u5c06\u4e00\u7aef\u653e\u7f6e\u5230\u5bb9\u5668\u7684\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u4e2d\uff0c\u53e6\u4e00\u7aef\u8fde\u63a5\u5230\u5bbf\u4e3b\u673a\u6216\u5176\u4ed6\u7f51\u7edc\u57fa\u7840\u8bbe\u65bd\u3002<\/p>\n\n\n\n \u3000\u3000\u914d\u7f6e\u6587\u4ef6<\/strong>\uff1aCNI\u63d2\u4ef6\u901a\u8fc7\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\u6765\u8fdb\u884c\u7f51\u7edc\u914d\u7f6e\u3002\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e\u6bcf\u4e2a\u8282\u70b9\u7684\/etc\/cni\/net.d\/\u76ee\u5f55\u4e0b\uff0c\u5e76\u6307\u5bfcCNI\u63d2\u4ef6\u5982\u4f55\u4e3a\u5bb9\u5668\u5efa\u7acb\u7f51\u7edc\u8fde\u63a5\u3002<\/p>\n\n\n\n \u3000\u3000\u8c03\u7528\u673a\u5236<\/strong>\uff1a\u5f53\u5bb9\u5668\u542f\u52a8\u65f6\uff0cKubernetes\u4f1a\u8c03\u7528\u76f8\u5e94\u7684CNI\u63d2\u4ef6\u6765\u6267\u884c\u7f51\u7edc\u914d\u7f6e\u3002\u63d2\u4ef6\u4f1a\u6839\u636e\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\uff0c\u4e3a\u5bb9\u5668\u521b\u5efa\u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u3001\u5206\u914dIP\u5730\u5740\u3001\u8bbe\u7f6e\u8def\u7531\u89c4\u5219\u7b49\u3002<\/p>\n\n\n\n \u3000\u3000Pod\u521b\u5efa<\/strong>\uff1aKubelet\u63a5\u6536\u5230Pod\u521b\u5efa\u8bf7\u6c42\u540e\uff0c\u6839\u636ePod\u7684\u7f51\u7edc\u9700\u6c42\u8c03\u7528\u76f8\u5e94\u7684CNI\u63d2\u4ef6\u3002<\/p>\n\n\n\n \u3000\u3000\u8c03\u7528CNI\u63d2\u4ef6<\/strong>\uff1aKubelet\u8c03\u7528CNI\u63d2\u4ef6\u8fdb\u884c\u7f51\u7edc\u914d\u7f6e\uff0c\u5305\u62ec\u5206\u914dIP\u5730\u5740\u3001\u8bbe\u7f6e\u8def\u7531\u548c\u7f51\u7edc\u89c4\u5219\u3002<\/p>\n\n\n\n \u3000\u3000\u5b8c\u6210\u7f51\u7edc\u8bbe\u7f6e<\/strong>\uff1aCNI\u63d2\u4ef6\u5b8c\u6210\u7f51\u7edc\u914d\u7f6e\u540e\uff0cPod\u7684\u5bb9\u5668\u542f\u52a8\u5e76\u4f7f\u7528\u914d\u7f6e\u597d\u7684\u7f51\u7edc\u3002<\/p>\n\n\n\n \u3000\u3000Calico<\/strong>\uff1a\u57fa\u4e8eBGP\u7684\u7f51\u7edc\u63d2\u4ef6\uff0c\u652f\u6301\u7f51\u7edc\u7b56\u7565\u3002<\/p>\n\n\n\n \u3000\u3000Flannel<\/strong>\uff1a\u4f7f\u7528VXLAN\u6216UDP\u5c01\u88c5\u7684\u7b80\u5355\u7f51\u7edc\u63d2\u4ef6\u3002<\/p>\n\n\n\n \u3000\u3000Weave Net<\/strong>\uff1a\u6613\u4e8e\u90e8\u7f72\u7684\u7f51\u7edc\u63d2\u4ef6\uff0c\u652f\u6301\u52a0\u5bc6\u548c\u7f51\u7edc\u7b56\u7565\u3002<\/p>\n\n\n\n \u3000\u3000Cilium<\/strong>\uff1a\u57fa\u4e8eeBPF\u7684\u9ad8\u6027\u80fd\u548c\u5b89\u5168\u7b56\u7565\u7f51\u7edc\u63d2\u4ef6\u3002<\/p>\n\n\n\n \u3000\u3000Flannel\u548cCalico\u662fKubernetes\u4e2d\u5e38\u7528\u7684\u4e24\u79cd\u7f51\u7edc\u63d2\u4ef6\uff0c\u5b83\u4eec\u5728\u6027\u80fd\u548c\u5b89\u5168\u6027\u65b9\u9762\u5404\u6709\u4f18\u7f3a\u70b9\u3002<\/p>\n\n\n\n \u3000\u3000Flannel<\/strong>\uff1a<\/p>\n\n\n\n \u3000\u3000Flannel\u4f7f\u7528Overlay\u7f51\u7edc\u6280\u672f\uff0c\u5982VXLAN\u3001GRE\u548cHost-gw\uff0c\u901a\u8fc7\u5728\u7269\u7406\u7f51\u7edc\u4e4b\u4e0a\u6784\u5efa\u865a\u62df\u7f51\u7edc\u5b9e\u73b0\u5bb9\u5668\u95f4\u901a\u4fe1\u3002\u8fd9\u79cd\u6280\u672f\u867d\u7136\u7b80\u5355\u6613\u7528\uff0c\u4f46\u53ef\u80fd\u4f1a\u5f15\u5165\u989d\u5916\u7684\u7f51\u7edc\u5ef6\u8fdf\u548c\u6027\u80fd\u5f00\u9500\u3002<\/p>\n\n\n\n \u3000\u3000Flannel\u7684VXLAN\u6a21\u5f0f\u5728\u5c0f\u5305\u4f20\u8f93\u65f6\u4f1a\u663e\u8457\u964d\u4f4e\u7f51\u7edc\u6548\u7387\uff0c\u56e0\u4e3aVXLAN\u62a5\u6587\u6bd4\u539f\u59cb\u62a5\u6587\u591a\u51fa50\u4e2a\u5b57\u8282\uff0c\u8fd9\u5728\u5c0f\u5305\u4f20\u8f93\u65f6\u4f1a\u8fdb\u4e00\u6b65\u964d\u4f4e\u7f51\u7edc\u6027\u80fd\u3002<\/p>\n\n\n\n \u3000\u3000Flannel\u901a\u5e38\u63d0\u4f9b\u826f\u597d\u7684\u6027\u80fd\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u6bd4Calico\u6709\u66f4\u9ad8\u7684\u7f51\u7edc\u5ef6\u8fdf\u3002<\/p>\n\n\n\n \u3000\u3000Calico<\/strong>\uff1a<\/p>\n\n\n\n \u3000\u3000Calico\u91c7\u7528\u57fa\u4e8e\u8def\u7531\u7684\u65b9\u6cd5\uff0c\u6bcf\u4e2a\u5bb9\u5668\u62e5\u6709\u552f\u4e00IP\u5730\u5740\uff0c\u901a\u8fc7\u8282\u70b9\u4e0a\u7684agent\u5c06\u8def\u7531\u89c4\u5219\u4e0b\u53d1\u81f3\u5185\u6838\uff0c\u5b9e\u73b0\u5bb9\u5668\u95f4\u901a\u4fe1\u3002\u8fd9\u79cd\u6280\u672f\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7684\u7f51\u7edc\u6027\u80fd\uff0c\u5c24\u5176\u662f\u5728\u5927\u89c4\u6a21\u90e8\u7f72\u65f6\u8868\u73b0\u4f18\u5f02\u3002<\/p>\n\n\n\n \u3000\u3000Calico\u652f\u6301IP-in-IP\u6216BGP\u6a21\u5f0f\uff0c\u5176\u4e2dIP-in-IP\u6a21\u5f0f\u53ea\u5728\u539f\u59cb\u62a5\u6587\u4e0a\u6dfb\u52a0\u4e8620\u4e2a\u5b57\u8282\u7684\u65b0\u7684IP\u5934\uff0c\u56e0\u6b64\u5728\u76f8\u540c\u96a7\u9053\u6a21\u5f0f\u4e0b\uff0cCalico\u7684\u7f51\u7edc\u6027\u80fd\u4f18\u4e8eFlannel\u3002<\/p>\n\n\n\n \u3000\u3000Calico\u7684\u6027\u80fd\u63a5\u8fd1Host\u7684\u6027\u80fd\uff0c\u9002\u5408\u9700\u8981\u9ad8\u6027\u80fd\u7f51\u7edc\u73af\u5883\u7684\u573a\u666f\u3002<\/p>\n\n\n\n \u3000\u3000Flannel<\/strong>\uff1a<\/p>\n\n\n\n \u3000\u3000Flannel\u9ed8\u8ba4\u4e0d\u63d0\u4f9b\u590d\u6742\u7684\u7f51\u7edc\u7b56\u7565\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u96c6\u6210\u5176\u4ed6\u5de5\u5177(\u5982Cilium)\u6765\u589e\u5f3a\u5b89\u5168\u6027\u3002<\/p>\n\n\n\n \u3000\u3000Flannel\u4f7f\u7528\u7f51\u7edc\u7b56\u7565\u9650\u5236\u901a\u4fe1\uff0c\u4f46\u5176\u5b89\u5168\u6027\u8f83\u5f31\uff0c\u4e0d\u5982Calico\u3002<\/p>\n\n\n\n \u3000\u3000Calico<\/strong>\uff1a<\/p>\n\n\n\n \u3000\u3000Calico\u63d0\u4f9b\u5f3a\u5927\u7684\u7f51\u7edc\u5b89\u5168\u7b56\u7565\uff0c\u5141\u8bb8\u7528\u6237\u7ec6\u7c92\u5ea6\u5730\u63a7\u5236\u5bb9\u5668\u95f4\u7684\u6d41\u91cf\uff0c\u8fd9\u5728\u5927\u578b\u4f01\u4e1a\u73af\u5883\u4e2d\u975e\u5e38\u6709\u7528\u3002<\/p>\n\n\n\n \u3000\u3000Calico\u8fd8\u63d0\u4f9b\u52a0\u5bc6\u548c\u8eab\u4efd\u9a8c\u8bc1\u529f\u80fd\uff0c\u8fdb\u4e00\u6b65\u589e\u5f3a\u4e86\u5b89\u5168\u6027\u3002<\/p>\n\n\n\n \u3000\u3000\u6027\u80fd<\/strong>\uff1aCalico\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u63d0\u4f9b\u4e86\u8f83\u9ad8\u7684\u7f51\u7edc\u6027\u80fd\uff0c\u5c24\u5176\u662f\u5728\u5927\u89c4\u6a21\u90e8\u7f72\u548c\u9ad8\u6027\u80fd\u9700\u6c42\u7684\u573a\u666f\u4e2d\u3002Flannel\u867d\u7136\u7b80\u5355\u6613\u7528\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u6709\u66f4\u9ad8\u7684\u7f51\u7edc\u5ef6\u8fdf\u3002<\/p>\n\n\n\n \u3000\u3000\u5b89\u5168\u6027<\/strong>\uff1aCalico\u5728\u7f51\u7edc\u5b89\u5168\u65b9\u9762\u8868\u73b0\u66f4\u4f73\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7f51\u7edc\u7b56\u7565\u548c\u5b89\u5168\u529f\u80fd\u3002Flannel\u7684\u5b89\u5168\u6027\u8f83\u5f31\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u96c6\u6210\u5176\u4ed6\u5de5\u5177\u6765\u589e\u5f3a\u3002<\/p>\n\n\n\n \u3000\u3000\u9009\u62e9Flannel\u8fd8\u662fCalico\u4e3b\u8981\u53d6\u51b3\u4e8e\u5177\u4f53\u9700\u6c42\u3002\u5982\u679c\u66f4\u6ce8\u91cd\u7f51\u7edc\u6027\u80fd\u548c\u7075\u6d3b\u6027\uff0c\u5efa\u8bae\u4f7f\u7528Flannel;<\/p>\n\n\n\n \u3000\u3000\u5728Kubernetes\u4e2d\uff0cService\u7684\u8d1f\u8f7d\u5747\u8861\u673a\u5236\u4e3b\u8981\u901a\u8fc7kube-proxy\u7ec4\u4ef6\u5b9e\u73b0\u3002kube-proxy\u5728\u6bcf\u4e2a\u8282\u70b9\u4e0a\u8fd0\u884c\uff0c\u8d1f\u8d23\u7ef4\u62a4\u548c\u66f4\u65b0iptables\u6216ipvs\u89c4\u5219\uff0c\u4ee5\u5c06\u6d41\u91cf\u4eceService\u7684Cluster IP\u5730\u5740\u8f6c\u53d1\u5230\u540e\u7aef\u7684Pod\u4e0a\u3002<\/p>\n\n\n\n \u3000\u3000\u5177\u4f53\u6765\u8bf4\uff0cService\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\uff1a<\/p>\n\n\n\n \u3000\u3000\u521b\u5efaService\u5bf9\u8c61<\/strong>\uff1a\u5f53\u521b\u5efa\u4e00\u4e2aService\u65f6\uff0cKubernetes\u4f1a\u751f\u6210\u4e00\u4e2aEndpoint\u5bf9\u8c61\uff0c\u8be5\u5bf9\u8c61\u5305\u542b\u4e86\u6240\u6709\u4e0eService\u5173\u8054\u7684Pod\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u4fe1\u606f\u3002<\/p>\n\n\n\n \u3000\u3000iptables\u89c4\u5219<\/strong>\uff1akube-proxy\u4f7f\u7528iptables\u6216ipvs\u89c4\u5219\u6765\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\u3002iptables\u662f\u4e00\u79cd\u7f51\u7edc\u5305\u8fc7\u6ee4\u5de5\u5177\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5b9a\u4e49\u89c4\u5219\u5bf9\u7f51\u7edc\u6570\u636e\u5305\u8fdb\u884c\u8fc7\u6ee4\u3001\u4fee\u6539\u548c\u91cd\u5b9a\u5411\u3002kube-proxy\u5229\u7528iptables\u89c4\u5219\u5c06\u6d41\u91cf\u4eceService\u7684Cluster IP\u5730\u5740\u8f6c\u53d1\u5230\u540e\u7aef\u7684Pod\u4e0a\u3002<\/p>\n\n\n\n \u3000\u3000\u8d1f\u8f7d\u5747\u8861\u7b97\u6cd5<\/strong>\uff1aKubernetes\u652f\u6301\u591a\u79cd\u8d1f\u8f7d\u5747\u8861\u7b97\u6cd5\uff0c\u5305\u62ec\u8f6e\u8be2(Round Robin)\u3001\u6700\u5c11\u8fde\u63a5(Least Connection)\u548cIP\u54c8\u5e0c(IP Hash)\u7b49\u3002\u8fd9\u4e9b\u7b97\u6cd5\u53ef\u4ee5\u5728Service\u914d\u7f6e\u4e2d\u6307\u5b9a\uff0c\u6216\u8005\u4f7f\u7528\u9ed8\u8ba4\u7b97\u6cd5\u3002<\/p>\n\n\n\n \u3000\u3000\u52a8\u6001\u66f4\u65b0\u89c4\u5219<\/strong>\uff1akube-proxy\u4f1a\u76d1\u542cService\u548cEndpoint\u5bf9\u8c61\u7684\u53d8\u5316\uff0c\u52a8\u6001\u66f4\u65b0iptables\u6216ipvs\u89c4\u5219\uff0c\u786e\u4fdd\u6d41\u91cf\u59cb\u7ec8\u88ab\u6b63\u786e\u5730\u5206\u53d1\u5230\u53ef\u7528\u7684Pod\u4e0a\u3002<\/p>\n\n\n\n \u3000\u3000\u670d\u52a1\u53d1\u73b0<\/strong>\uff1aKubernetes\u901a\u8fc7DNS\u89e3\u6790\u4e3a\u6bcf\u4e2aService\u914d\u7f6e\u4e00\u4e2aDNS\u540d\u79f0\uff0c\u4ece\u800c\u5b9e\u73b0\u670d\u52a1\u53d1\u73b0\u3002\u5f53\u5176\u4ed6Pod\u9700\u8981\u8bbf\u95ee\u67d0\u4e2aService\u65f6\uff0c\u5b83\u4eec\u53ef\u4ee5\u901a\u8fc7DNS\u540d\u79f0\u6765\u8bbf\u95ee\uff0c\u800c\u65e0\u9700\u5173\u5fc3\u5177\u4f53\u7684IP\u5730\u5740\u3002<\/p>\n\n\n\n \u3000\u3000\u4e0d\u540c\u7c7b\u578b\u7684Service<\/strong>\uff1aKubernetes\u63d0\u4f9b\u4e86\u591a\u79cd\u7c7b\u578b\u7684Service\uff0c\u6bcf\u79cd\u7c7b\u578b\u6709\u4e0d\u540c\u7684\u8d1f\u8f7d\u5747\u8861\u5b9e\u73b0\u65b9\u5f0f\uff1a<\/p>\n\n\n\n \u3000\u3000ClusterIP<\/strong>\uff1a\u9ed8\u8ba4\u7c7b\u578b\uff0c\u521b\u5efa\u4e00\u4e2a\u96c6\u7fa4\u5185\u90e8\u7684\u865a\u62dfIP\u5730\u5740\uff0c\u6d41\u91cf\u901a\u8fc7\u8fd9\u4e2aIP\u5730\u5740\u88ab\u5206\u53d1\u5230\u540e\u7aef\u7684Pod\u4e0a\u3002<\/p>\n\n\n\n \u3000\u3000NodePort<\/strong>\uff1a\u901a\u8fc7\u6bcf\u4e2aNode\u4e0a\u7684\u7aef\u53e3\u8bbf\u95ee\u670d\u52a1\uff0c\u9002\u7528\u4e8e\u96c6\u7fa4\u5916\u90e8\u8bbf\u95ee\u3002<\/p>\n\n\n\n \u3000\u3000LoadBalancer<\/strong>\uff1a\u901a\u5e38\u4e0e\u4e91\u5e73\u53f0\u7ed3\u5408\u4f7f\u7528\uff0c\u901a\u8fc7\u5916\u90e8\u8d1f\u8f7d\u5747\u8861\u5668\u66b4\u9732\u670d\u52a1\u3002<\/p>\n\n\n\n \u3000\u3000Ingress<\/strong>\uff1a\u901a\u8fc7HTTP\/HTTPS\u534f\u8bae\u66b4\u9732\u670d\u52a1\uff0c\u652f\u6301\u8def\u7531\u3001SSL\/TLS\u7b49\u529f\u80fd\u3002<\/p>\n\n\n\n \u3000\u3000Headless Service<\/strong>\uff1aHeadless Service\u662f\u4e00\u79cd\u7279\u6b8a\u7684Service\u7c7b\u578b\uff0c\u5b83\u4e0d\u5206\u914dCluster IP\u5730\u5740\uff0c\u800c\u662f\u901a\u8fc7DNS\u89e3\u6790\u540e\u7aefPod\u7684IP\u5730\u5740\u6765\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\u548c\u7edf\u4e00\u8bbf\u95ee\u5165\u53e3\u3002<\/p>\n\n\n\n \u3000\u3000Kubernetes\u7f51\u7edc\u6a21\u578b\u9762\u4e34\u7684\u6027\u80fd\u6311\u6218\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n\n\n\n \u3000\u3000\u7f51\u7edc\u5ef6\u8fdf\u548c\u5e26\u5bbd\u9650\u5236<\/strong>\uff1a\u5728\u5927\u89c4\u6a21\u96c6\u7fa4\u4e2d\uff0c\u7f51\u7edc\u5ef6\u8fdf\u548c\u5e26\u5bbd\u6210\u4e3a\u6027\u80fd\u74f6\u9888\u3002\u4f8b\u5982\uff0c\u5f53\u8282\u70b9\u6570\u91cf\u589e\u52a0\u52305000\u4e2a\u65f6\uff0c\u7f51\u7edc\u6027\u80fd\u663e\u8457\u4e0b\u964d\uff0c\u5c24\u5176\u662f\u5728\u4f7f\u7528Flannel\u7b49CNI\u63d2\u4ef6\u65f6\uff0c\u7f51\u7edc\u5e26\u5bbd\u4ec5\u80fd\u8fbe\u5230\u7ea62GBit\/s\uff0c\u800c\u5b9e\u9645\u9700\u6c42\u53ef\u80fd\u9700\u8981\u66f4\u9ad8\u7684\u5e26\u5bbd\u3002<\/p>\n\n\n\n \u3000\u3000\u7f51\u7edc\u7b56\u7565\u548c\u914d\u7f6e\u590d\u6742\u6027<\/strong>\uff1a\u5408\u7406\u914d\u7f6e\u7f51\u7edc\u7b56\u7565\u3001Service\u548cIngress\u662f\u63d0\u5347\u5e94\u7528\u53ef\u9760\u6027\u548c\u5b89\u5168\u6027\u7684\u91cd\u8981\u624b\u6bb5\uff0c\u4f46\u8fd9\u4e9b\u914d\u7f6e\u7684\u590d\u6742\u6027\u4e5f\u589e\u52a0\u4e86\u8fd0\u7ef4\u7684\u96be\u5ea6\u3002<\/p>\n\n\n\n \u3000\u3000\u5b58\u50a8\u6027\u80fd\u74f6\u9888<\/strong>\uff1a\u5728\u5927\u89c4\u6a21\u6570\u636e\u96c6\u7fa4\u4e2d\uff0c\u5b58\u50a8\u7cfb\u7edf\u7684\u9ad8\u5e76\u53d1\u3001\u9ad8\u541e\u5410\u91cf\u548c\u4f4e\u5ef6\u8fdf\u8981\u6c42\u6210\u4e3a\u5173\u952e\u6311\u6218\u3002\u4f8b\u5982\uff0c\u5728Hadoop\u5728Kubernetes\u4e0a\u7684\u90e8\u7f72\u4e2d\uff0c\u6587\u4ef6\u8bfb\u53d6\u6027\u80fd\u4e0b\u964d\u7ea630%\uff0c\u4e3b\u8981\u662f\u7531\u4e8e\u5bb9\u5668\u865a\u62df\u7f51\u7edc\u5e26\u6765\u7684\u6027\u80fd\u635f\u8017\u3002<\/p>\n\n\n\n \u3000\u3000\u8d44\u6e90\u7ade\u4e89\u548c\u8c03\u5ea6\u5ef6\u8fdf<\/strong>\uff1a\u968f\u7740\u8282\u70b9\u6570\u91cf\u7684\u589e\u52a0\uff0c\u8d44\u6e90\u7ade\u4e89\u548c\u8c03\u5ea6\u5ef6\u8fdf\u95ee\u9898\u4e5f\u53d8\u5f97\u66f4\u52a0\u7a81\u51fa\u3002\u4f8b\u5982\uff0c\u5728\u8282\u70b9\u6570\u91cf\u8fbe\u52301000\u52302000\u4e2a\u65f6\uff0cetcd\u7684\u78c1\u76d8\u7a7a\u95f4\u9650\u5236\u5bfc\u81f4\u65e0\u6cd5\u5199\u5165\u6570\u636e\u7684\u9519\u8bef\u3002<\/p>\n\n\n\n \u3000\u3000\u591a\u8def\u5f84\u7f51\u7edc\u534f\u8bae\u548c\u8d1f\u8f7d\u5747\u8861\u5668\u7684\u4f7f\u7528<\/strong>\uff1a\u4e3a\u4e86\u63d0\u5347\u4f20\u8f93\u901f\u5ea6\u548c\u53ef\u9760\u6027\uff0c\u9700\u8981\u91c7\u7528\u9ad8\u5e26\u5bbd\u7f51\u7edc\u3001\u591a\u8def\u5f84\u7f51\u7edc\u534f\u8bae\u548c\u8d1f\u8f7d\u5747\u8861\u5668\u3002<\/p>\n\n\n\n \u3000\u3000\u9488\u5bf9\u4e0a\u8ff0\u6311\u6218\uff0c\u53ef\u4ee5\u91c7\u53d6\u4ee5\u4e0b\u4f18\u5316\u63aa\u65bd\uff1a<\/p>\n\n\n\n \u3000\u3000\u9009\u62e9\u5408\u9002\u7684CNI\u63d2\u4ef6<\/strong>\uff1a\u6839\u636e\u5b9e\u9645\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684CNI\u63d2\u4ef6\uff0c\u5982Calico\u3001Weave\u7b49\uff0c\u8fd9\u4e9b\u63d2\u4ef6\u901a\u5e38\u6bd4Flannel\u66f4\u9ad8\u6548\uff0c\u80fd\u591f\u63d0\u4f9b\u66f4\u9ad8\u7684\u7f51\u7edc\u6027\u80fd\u3002<\/p>\n\n\n\n \u3000\u3000\u4f18\u5316\u7f51\u7edc\u7b56\u7565\u548c\u914d\u7f6e<\/strong>\uff1a\u5408\u7406\u914d\u7f6e\u7f51\u7edc\u7b56\u7565\u3001Service\u548cIngress\uff0c\u786e\u4fdd\u5e94\u7528\u7684\u53ef\u9760\u6027\u548c\u5b89\u5168\u6027\u3002\u540c\u65f6\uff0c\u901a\u8fc7\u76d1\u63a7\u5de5\u5177\u5982Prometheus\u548cGrafana\u8fdb\u884c\u5b9e\u65f6\u76d1\u63a7\u548c\u65e5\u5fd7\u5206\u6790\uff0c\u53ca\u65f6\u53d1\u73b0\u548c\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n\n\n\n \u3000\u3000\u4f7f\u7528\u9ad8\u6027\u80fd\u5b58\u50a8\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a\u91c7\u7528\u672c\u5730\u5b58\u50a8\u3001\u9ad8\u6027\u80fd\u5b58\u50a8\u548c\u4e91\u5b58\u50a8\uff0c\u51cf\u5c11\u5ef6\u8fdf\u3001\u63d0\u9ad8\u8bbf\u95ee\u901f\u5ea6\u548c\u589e\u5f3a\u6570\u636e\u5b89\u5168\u6027\u3002<\/p>\n\n\n\n \u3000\u3000\u4f18\u5316\u8c03\u5ea6\u7b56\u7565<\/strong>\uff1a\u5408\u7406\u8bbe\u7f6ePod\u8d44\u6e90\u8bf7\u6c42\u548c\u9650\u5236\uff0c\u4f18\u5316\u8c03\u5ea6\u7b56\u7565\uff0c\u907f\u514d\u8d44\u6e90\u7ade\u4e89\u548c\u8c03\u5ea6\u5ef6\u8fdf\u3002\u4f8b\u5982\uff0c\u901a\u8fc7\u8c03\u6574kube-apiserver\u7684\u6293\u53d6\u9891\u7387\u548c\u4f18\u5316etcd\u7684\u4e8b\u4ef6\u5904\u7406\u65b9\u5f0f\u6765\u63d0\u5347\u6027\u80fd\u3002<\/p>\n\n\n\n \u3000\u3000\u5229\u7528\u5206\u5e03\u5f0f\u7f13\u5b58\u6280\u672f<\/strong>\uff1a\u5728\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u8bad\u7ec3\u4e2d\uff0c\u5229\u7528Alluxio\u7b49\u5206\u5e03\u5f0f\u7f13\u5b58\u6280\u672f\u4f18\u5316\u6570\u636e\u8bbf\u95ee\u6027\u80fd\uff0c\u51cf\u5c11\u591a\u6b21GRPC\u4ea4\u4e92\u548c\u6570\u636e\u7f13\u5b58\u7b56\u7565\u5e26\u6765\u7684\u74f6\u9888\u3002<\/p>\n\n\n\n \u3000\u3000\u91c7\u7528Host Only\u7f51\u7edc\u6a21\u578b<\/strong>\uff1a\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u91c7\u7528Host Only\u7684\u7f51\u7edc\u6a21\u578b\uff0c\u4ee5\u63d0\u5347Hadoop\u96c6\u7fa4\u7684\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" Kubernetes\u7684\u7f51\u7edc\u6a21\u578b\u901a\u8fc7CNI\u63d2\u4ef6\u4e0e\u7b2c\u4e09\u65b9\u7f51\u7edc\u63d2\u4ef6\u7684\u96c6\u6210\uff0c\u5b9e\u73b0\u4e86\u9ad8\u6548\u3001\u7075\u6d3b\u7684\u5bb9\u5668\u7f51\u7edc\u7ba1\u7406\u3002\u5176\u6838\u5fc3\u5728\u4e8e\u6bcf\u4e2aPod\u62e5\u6709\u72ec\u7acbIP\uff0c\u5e76\u901a\u8fc7\u8986\u76d6\u7f51\u7edc\u6216\u8def\u7531\u65b9\u6848\u5b9e\u73b0\u4e92\u901a<\/p>\n","protected":false},"author":1,"featured_media":99652,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[354],"class_list":["post-100202","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-wlxy"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/100202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=100202"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/100202\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/99652"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=100202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=100202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=100202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\u3000\u3000\u4e00\u3001 K8s\u7f51\u7edc\u539f\u7406\u4ecb\u7ecd<\/h2>\n\n\n\n
\u3000\u30001. Kubernetes\u7f51\u7edc\u6a21\u578b\u7684\u57fa\u672c\u6982\u5ff5<\/h3>\n\n\n\n
\u3000\u30002. \u7f51\u7edc\u547d\u540d\u7a7a\u95f4\u4e0eVeth\u8bbe\u5907\u5bf9<\/h3>\n\n\n\n
\u3000\u30003. \u7f51\u7edc\u63d2\u4ef6\u4e0eCNI(Container Network Interface)<\/h3>\n\n\n\n
\u3000\u30004. \u4e3b\u6d41\u7f51\u7edc\u63d2\u4ef6\u53ca\u5176\u5b9e\u73b0\u65b9\u5f0f<\/h3>\n\n\n\n
\u3000\u30005. Pod\u4e0eService\u7684\u7f51\u7edc\u901a\u4fe1<\/h3>\n\n\n\n
\u3000\u30006. \u5916\u90e8\u8bbf\u95ee\u4e0e\u670d\u52a1\u53d1\u73b0<\/h3>\n\n\n\n
\u3000\u30007. \u7f51\u7edc\u7ec4\u4ef6\u4e0e\u5de5\u4f5c\u6d41\u7a0b<\/h3>\n\n\n\n
\u3000\u30008. \u7f51\u7edc\u6a21\u578b\u7684\u4f18\u52bf\u4e0e\u6311\u6218<\/h3>\n\n\n\n
\n
\u3000\u3000\u603b\u7ed3<\/h3>\n\n\n\n
\u3000\u3000\u4e8c\u3001 Kubernetes\u7f51\u7edc\u6a21\u578b\u4e2d\uff0cVeth\u8bbe\u5907\u5bf9\u539f\u7406<\/h2>\n\n\n\n
\u3000\u3000\u4e09\u3001 CNI\u63d2\u4ef6\u5728Kubernetes\u7f51\u7edc\u914d\u7f6e\u4e2d\u7684\u5177\u4f53\u4f5c\u7528\u548c\u5b9e\u73b0\u673a\u5236\u6709\u54ea\u4e9b?<\/h2>\n\n\n\n
\u3000\u30001. \u5177\u4f53\u4f5c\u7528<\/h3>\n\n\n\n
\u3000\u30002. \u5b9e\u73b0\u673a\u5236<\/h3>\n\n\n\n
\u3000\u30003. \u5de5\u4f5c\u6d41\u7a0b<\/h3>\n\n\n\n
\u3000\u30004. \u5e38\u89c1\u7684CNI\u63d2\u4ef6<\/h3>\n\n\n\n
\u3000\u3000\u56db\u3001 Flannel\u548cCalico\u7f51\u7edc\u63d2\u4ef6\u5728\u6027\u80fd\u548c\u5b89\u5168\u6027\u65b9\u9762\u7684\u6bd4\u8f83\u5982\u4f55?<\/h2>\n\n\n\n
\u3000\u30001. \u6027\u80fd\u65b9\u9762<\/h3>\n\n\n\n
\u3000\u30002. \u5b89\u5168\u6027\u65b9\u9762<\/h3>\n\n\n\n
\u3000\u30003. \u603b\u7ed3<\/h3>\n\n\n\n
\u3000\u3000\u4e94\u3001 Kubernetes\u4e2dService\u7684\u8d1f\u8f7d\u5747\u8861\u673a\u5236\u662f\u5982\u4f55\u5b9e\u73b0\u7684?<\/h2>\n\n\n\n
\u3000\u3000\u516d\u3001 Kubernetes\u7f51\u7edc\u6a21\u578b\u9762\u4e34\u7684\u6027\u80fd\u6311\u6218\u6709\u54ea\u4e9b\uff0c\u4ee5\u53ca\u5982\u4f55\u4f18\u5316?<\/h2>\n\n\n\n