{"id":11767,"date":"2023-08-10T22:22:28","date_gmt":"2023-08-10T14:22:28","guid":{"rendered":"http:\/\/92it.top\/?p=11767"},"modified":"2023-08-21T21:51:11","modified_gmt":"2023-08-21T13:51:11","slug":"k8s%e5%ad%a6%e4%b9%a0%e5%88%9d%e6%8e%a2-k8s%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5%e5%bf%ab%e9%80%9f%e4%b8%80%e8%a7%88","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=11767","title":{"rendered":"K8S\u5b66\u4e60\u521d\u63a2 K8S\u57fa\u672c\u6982\u5ff5\u5feb\u901f\u4e00\u89c8"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1a<a href=\"https:\/\/www.cnblogs.com\/edisonchou\/p\/aspnet_core_on_k8s_firststudy_part2.html\">https:\/\/www.cnblogs.com\/edisonchou\/p\/aspnet_core_on_k8s_firststudy_part2.html<\/a><\/p>\n\n\n\n<p>\u5728\u4e0a\u4e00\u7bc7\u300a<a href=\"https:\/\/www.cnblogs.com\/edisonchou\/p\/aspnet_core_on_k8s_firststudy_part1.html\">\u5355\u8282\u70b9\u73af\u5883\u642d\u5efa<\/a>\u300b\u4e2d\uff0c\u901a\u8fc7Docker for Windows\u5728Windows\u5f00\u53d1\u673a\u4e2d\u642d\u5efa\u4e86\u4e00\u4e2a\u5355\u8282\u70b9\u7684K8S\u73af\u5883\uff0c\u63a5\u4e0b\u6765\u5c31\u662f\u52a8\u4eba\u5fc3\u5f26\u7684\u90e8\u7f72ASP.NET Core API\u5230K8S\u4e86\u3002\u4f46\u662f\uff0c\u5728\u90e8\u7f72\u4e4b\u524d\uff0c\u6211\u8fd8\u662f\u628a\u57fa\u672c\u7684\u4e00\u4e9b\u6982\u5ff5<em><strong>\u5feb\u901f\u5730\u7b80\u5355\u5730\u4e0d\u6c42\u751a\u89e3\u5730<\/strong><\/em>\u8fc7\u4e00\u4e0b\u3002<\/p>\n\n\n\n<p><strong>\u4e00\u3001K8S\u96c6\u7fa4\u57fa\u672c\u6982\u5ff5<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>\uff081\uff09\u96c6\u7fa4<\/strong><\/p>\n\n\n\n<p>\u9996\u5148\uff0cK8S\u96c6\u7fa4\u4e5f\u662f\u9700\u8981\u591a\u53f0\u670d\u52a1\u5668\u7ec4\u6210\uff0c\u4f5c\u4e3a\u5bb9\u5668\u7684\u7f16\u6392\u7ba1\u7406\u5e73\u53f0\uff0c\u53ea\u6709\u4e00\u4e2a\u8282\u70b9\u5728\u751f\u4ea7\u73af\u5883\u662f\u4e0d\u591f\u7684\u3002<\/p>\n\n\n\n<p><strong>\uff082\uff09Node<\/strong><\/p>\n\n\n\n<p>\u5176\u6b21\uff0cNode\u4f5c\u4e3aK8S\u96c6\u7fa4\u4e2d\u7684\u5de5\u4f5c\u8282\u70b9\uff0c\u4e00\u4e2aNode\u53ef\u4ee5\u662fVM\u6216\u7269\u7406\u673a\uff0c\u5b83\u8fd0\u884c\u771f\u6b63\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n\n\n\n<p>K8S\u4e2d\u7684Node\u53c8\u5206\u4e3aMaster\u548cWorker\uff0c\u548cHadoop\u96c6\u7fa4\u4e2d\u7684NameNode\u548cDataNode\u7c7b\u4f3c\uff0c\u7b80\u800c\u8a00\u4e4b\u5c31\u662f\u4e00\u4e2a\u662f\u8d1f\u8d23\u8c03\u5ea6\uff08\u7ef4\u62a4\u96c6\u7fa4\u72b6\u6001\uff09\u7684\uff0c\u4e00\u4e2a\u662f\u8d1f\u8d23\u5e72\u6d3b\uff08\u8fd0\u884c\u5bb9\u5668\uff09\u7684\u3002<\/p>\n\n\n\n<p><strong>\uff083\uff09\u8d44\u6e90<\/strong><\/p>\n\n\n\n<p>\u5728K8S\u6bcf\u4e2a\u7ec4\u4ef6\uff08\u6bd4\u5982Pod\uff0cService\u7b49\uff09\u5f00\u653e\u5bf9\u5916\u66b4\u9732\u7684\u90fd\u662f\u4e00\u7ec4RESTful API\uff0c\u6240\u4ee5\u6211\u4eec\u6240\u6709\u5bf9\u4e8e\u7ec4\u4ef6\u7684\u64cd\u4f5c\u90fd\u53ef\u4ee5\u901a\u8fc7RESTful API\u6765\u5b8c\u6210\uff0c\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u770b\u4f5c\u662f\u8d44\u6e90\u3002<\/p>\n\n\n\n<p><strong>\uff084\uff09Kubectl<\/strong><\/p>\n\n\n\n<p>Kubectl\u662f\u4e00\u4e2a\u5ba2\u6237\u7aef\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u4f7f\u7528\u5b83\u53ef\u4ee5\u8fde\u63a5K8S\u96c6\u7fa4\u548c\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n\n\n\n<p>\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u6211\u4eec\u901a\u8fc7kubectl\u8f93\u5165\u547d\u4ee4\u4e0e\u8fdc\u7a0b\u7684K8S\u96c6\u7fa4\u8fde\u63a5\uff0c\u800c\u8fd9\u4e9b\u547d\u4ee4\u672c\u8d28\u662f\u901a\u8fc7\u8c03\u7528API\u8bbf\u95eeMaster\u8282\u70b9\u63d0\u4f9b\u7684API\uff0c\u901a\u8fc7\u8fd9\u4e9bAPI\u53bb\u64cd\u4f5c\u6240\u8c13\u7684\u96c6\u7fa4\u4e2d\u7684\u201c\u8d44\u6e90\u201d\uff0c\u5bf9\u8fd9\u4e9b\u8d44\u6e90\u8fdb\u884c\u521b\u5efa\uff08POST\uff09\uff0c\u4fee\u6539\uff08PUT\uff09\uff0c\u5220\u9664\uff08DELETE\uff09\u7b49\u64cd\u4f5c\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-1024x748.png\" alt=\"\" class=\"wp-image-11768\" width=\"442\" height=\"322\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-1024x748.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-300x219.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-768x561.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-830x606.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-550x400.png 550w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-230x168.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-350x256.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84-480x350.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-84.png 1186w\" sizes=\"(max-width: 442px) 100vw, 442px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u4e8c\u3001\u4e09\u5927\u6838\u5fc3\u5bf9\u8c61<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>\uff081\uff09Pod<\/strong><\/p>\n\n\n\n<p>Pod\u662fK8S\u6700\u57fa\u672c\u7684\u64cd\u4f5c\u5355\u5143\uff0c\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u7d27\u5bc6\u76f8\u5173\u7684\u5bb9\u5668\uff0c\u4e00\u4e2aPod\u53ef\u4ee5\u88ab\u4e00\u4e2a\u5bb9\u5668\u5316\u7684\u73af\u5883\u770b\u4f5c\u662f\u5e94\u7528\u5c42\u7684\u201c\u903b\u8f91\u5bbf\u4e3b\u673a\u201d\uff1b<\/p>\n\n\n\n<p>\u6362\u53e5\u8bdd\u8bf4\uff0c<strong>\u5728K8S\u4e2d\u521b\u5efa\uff0c\u8c03\u5ea6\u548c\u7ba1\u7406\u7684\u6700\u5c0f\u5355\u4f4d\u5c31\u662fPod<\/strong>\uff0c\u800c\u975e\u5bb9\u5668\uff08Container\uff09\uff0c\u591a\u4e2a\u5bb9\u5668\u4e4b\u95f4\u7684\u6302\u8f7d\u662f\u53ef\u4ee5\u5171\u4eab\u7684\uff0cPod\u901a\u8fc7\u63d0\u4f9b\u66f4\u9ad8\u5c42\u6b21\u7684\u62bd\u8c61\uff0c\u63d0\u4f9b\u4e86\u66f4\u52a0\u7075\u6d3b\u7684\u90e8\u7f72\u548c\u7ba1\u7406\u6a21\u5f0f\uff1b<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-1024x368.png\" alt=\"\" class=\"wp-image-11769\" width=\"484\" height=\"173\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-1024x368.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-300x108.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-768x276.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-830x298.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-230x83.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-350x126.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85-480x172.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-85.png 1136w\" sizes=\"(max-width: 484px) 100vw, 484px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\uff082\uff09Service<\/strong><\/p>\n\n\n\n<p>Service\u662f\u4e00\u4e2a\u62bd\u8c61\u6982\u5ff5\uff0c\u5b83\u5b9a\u4e49\u4e86\u903b\u8f91\u96c6\u5408\u4e0b\u8bbf\u95eePod\u7ec4\u7684\u7b56\u7565\u3002\u901a\u8fc7\u4f7f\u7528Service\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4e0d\u7528\u5173\u5fc3\u8fd9\u4e2a\u670d\u52a1\u4e0b\u9762\u7684Pod\u7684\u589e\u52a0\u548c\u51cf\u5c11\u3001\u6545\u969c\u91cd\u542f\u7b49\uff0c\u53ea\u9700\u901a\u8fc7Service\u5c31\u80fd\u591f\u8bbf\u95ee\u5230\u5bf9\u5e94\u670d\u52a1\u7684\u5bb9\u5668\uff0c\u5373\u901a\u8fc7Service\u6765\u66b4\u9732Pod\u7684\u8d44\u6e90\u3002<\/p>\n\n\n\n<p>\u8fd9\u6837\u8bf4\u53ef\u80fd\u8fd8\u662f\u6709\u70b9\u96be\u61c2\uff0c\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5047\u8bbe\u6211\u4eec\u7684\u4e00\u4e2a\u670d\u52a1Service A\u4e0b\u9762\u67093\u4e2aPod\uff0c\u6211\u4eec\u90fd\u77e5\u9053Pod\u7684IP\u90fd\u4e0d\u662f\u6301\u4e45\u5316\u7684\uff0c\u91cd\u542f\u4e4b\u540e\u5c31\u4f1a\u6709\u53d8\u5316\u3002\u90a3\u4e48Service B\u60f3\u8981\u8bbf\u95eeService A\u7684Pod\uff0c\u5b83\u53ea\u9700\u8ddf\u7ed1\u5b9a\u4e86\u8fd93\u4e2aPod\u7684Service A\u6253\u4ea4\u9053\u5c31\u53ef\u4ee5\u4e86\uff0c\u65e0\u987b\u5173\u5fc3\u4e0b\u9762\u76843\u4e2aPod\u7684IP\u548c\u7aef\u53e3\u7b49\u4fe1\u606f\u7684\u53d8\u5316\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u5c31\u50cf\u4e00\u4e2aService Discovery\u670d\u52a1\u53d1\u73b0\u7684\u7ec4\u4ef6\uff0c\u4f60\u65e0\u987b\u5173\u5fc3\u5177\u4f53\u670d\u52a1\u7684URL\uff0c\u53ea\u9700\u77e5\u9053\u5b83\u4eec\u5728\u670d\u52a1\u53d1\u73b0\u4e2d\u6ce8\u518c\u7684Key\u5c31\u53ef\u4ee5\u901a\u8fc7\u7c7b\u4f3cConsul\u3001Eureka\u4e4b\u7c7b\u7684\u670d\u52a1\u53d1\u73b0\u7ec4\u4ef6\u4e2d\u83b7\u53d6\u5b83\u4eec\u7684URL\u4e00\u6837\uff0c\u8fd8\u662f\u5b9e\u73b0\u4e86\u8d1f\u8f7d\u5747\u8861\u6548\u679c\u7684URL\u3002<\/p>\n\n\n\n<p><strong>\uff083\uff09Deployment<\/strong><\/p>\n\n\n\n<p>Deployment\u4e3b\u8981\u8d1f\u8d23Pod\u7684\u7f16\u6392\uff0c\u4f8b\u5982\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684yaml\u6587\u4ef6\u6765\u521b\u5efa\u4e00\u4e2aDeployment\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.12.2\n        ports:\n        - containerPort: 80<\/pre>\n\n\n\n<p>\u719f\u6089Docker-Compose\u7684\u670b\u53cb\u5e94\u8be5\u5bf9\u8fd9\u4e2ayaml\u4e0d\u964c\u751f\uff0c\u53ef\u4ee5\u770b\u5230Deployment\u5b9a\u4e49\u4e86Pod\u5185\u5bb9\uff0c\u5305\u62ecPod\u6570\u91cf\u3001\u66f4\u65b0\u65b9\u5f0f\u3001\u4f7f\u7528\u7684\u955c\u50cf\uff0c\u8d44\u6e90\u9650\u5236\uff0c\u5bb9\u5668\u4e2d\u7684\u6620\u5c04\u7aef\u53e3\u7b49\u7b49\u3002<\/p>\n\n\n\n<p><strong>\u4e09\u3001Service\u7684\u51e0\u79cd\u7c7b\u578b<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>\uff081\uff09ClusterIP<\/strong><\/p>\n\n\n\n<p>&nbsp;ClusterIP \u670d\u52a1\u662f Kubernetes \u7684\u9ed8\u8ba4\u670d\u52a1\u3002\u5b83\u7ed9\u4f60\u4e00\u4e2a\u96c6\u7fa4\u5185\u7684\u670d\u52a1\uff0c\u96c6\u7fa4\u5185\u7684\u5176\u5b83\u5e94\u7528\u90fd\u53ef\u4ee5\u8bbf\u95ee\u8be5\u670d\u52a1\uff0c\u4f46\u662f\u96c6\u7fa4\u5916\u90e8\u65e0\u6cd5\u8bbf\u95ee\u5b83\u3002<\/p>\n\n\n\n<p>\u56e0\u6b64\uff0c\u8fd9\u79cd\u670d\u52a1\u5e38\u88ab\u7528\u4e8e\u5185\u90e8\u7a0b\u5e8f\u4e92\u76f8\u7684\u8bbf\u95ee\uff0c\u4e14\u4e0d\u9700\u8981\u5916\u90e8\u8bbf\u95ee\uff0c\u90a3\u4e48\u8fd9\u4e2a\u65f6\u5019\u7528ClusterIP\u5c31\u6bd4\u8f83\u5408\u9002\uff0c\u5982\u4e0b\u9762\u7684yaml\u6587\u4ef6\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apiVersion: v1\nkind: Service\nmetadata:  \nname: my-internal-service\nselector:    \napp: my-app\nspec:\ntype: ClusterIP\nports:  \n- name: http\nport: 80\ntargetPort: 80\nprotocol: TCP<\/pre>\n\n\n\n<p>\u90a3\u4e48\uff0c\u5982\u679c\u9700\u8981\u4ece\u5916\u90e8\u8bbf\u95ee\u5462\uff08\u6bd4\u5982\u6211\u4eec\u5728\u5f00\u53d1\u6a21\u5f0f\u4e0b\u603b\u5f97\u8c03\u8bd5\u5427\uff09\uff1f\u53ef\u4ee5\u542f\u7528K8S\u7684\u4ee3\u7406\u6a21\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ kubectl proxy --port=8080<\/pre>\n\n\n\n<p>\u5982\u6b64\u4e00\u6765\uff0c\u4fbf\u53ef\u4ee5\u901a\u8fc7K8S\u7684API\u6765\u8bbf\u95ee\u4e86\uff0c\u4f8b\u5982\u4e0b\u9762\u8fd9\u4e2aURL\u5c31\u53ef\u4ee5\u8bbf\u95ee\u5728yaml\u4e2d\u5b9a\u4e49\u7684\u8fd9\u4e2amy-internal-service\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/localhost:8080\/api\/v1\/proxy\/namespaces\/default\/services\/my-internal-service:http\/<\/pre>\n\n\n\n<p><strong>\uff082\uff09NodePort<\/strong><\/p>\n\n\n\n<p>\u9664\u4e86\u53ea\u5728\u5185\u90e8\u8bbf\u95ee\u7684\u670d\u52a1\uff0c\u6211\u4eec\u603b\u6709\u5f88\u591a\u662f\u9700\u8981\u66b4\u9732\u51fa\u6765\u516c\u5f00\u8bbf\u95ee\u7684\u670d\u52a1\u5427\u3002\u5728ClusterIP\u57fa\u7840\u4e0a\u4e3aService\u5728\u6bcf\u53f0\u673a\u5668\u4e0a\u7ed1\u5b9a\u4e00\u4e2a\u7aef\u53e3\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u901a\u8fc7:NodePort\u6765\u8bbf\u95ee\u8fd9\u4e9b\u670d\u52a1\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u8fd9\u4e2ayaml\u4e2d\u5b9a\u4e49\u4e86\u670d\u52a1\u4e3aNodePort\u7c7b\u578b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apiVersion: v1\nkind: Service\nmetadata:  \nname: my-nodeport-service\nselector:    \napp: my-app\nspec:\ntype: NodePort\nports:  \n- name: http\nport: 80\ntargetPort: 80\nnodePort: 30036\nprotocol: TCP<\/pre>\n\n\n\n<p><em><strong>PS<\/strong><\/em>\uff1a\u8fd9\u79cd\u65b9\u5f0f\u987e\u540d\u601d\u4e49\u9700\u8981\u4e00\u4e2a\u989d\u5916\u7684\u7aef\u53e3\u6765\u8fdb\u884c\u66b4\u9732\uff0c\u4e14\u7aef\u53e3\u8303\u56f4\u53ea\u80fd\u662f 30000-32767\uff0c\u5982\u679c\u8282\u70b9\/VM \u7684 IP \u5730\u5740\u53d1\u751f\u53d8\u5316\uff0c\u4f60\u9700\u8981\u80fd\u5904\u7406\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n\n\n\n<p><strong>\uff083\uff09LoadBalancer<\/strong><\/p>\n\n\n\n<p>LoadBalancer \u670d\u52a1\u662f\u66b4\u9732\u670d\u52a1\u5230 internet \u7684\u6807\u51c6\u65b9\u5f0f\uff0c\u5b83\u501f\u52a9Cloud Provider\u521b\u5efa\u4e00\u4e2a\u5916\u90e8\u7684\u8d1f\u8f7d\u5747\u8861\u5668\uff0c\u5e76\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230&lt;NodeIP&gt;:NodePort\uff08\u5411\u8282\u70b9\u5bfc\u6d41\uff09\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\u4e0b\u9762\u8fd9\u4e2ayaml\u4e2d\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">kind: Service\napiVersion: v1\nmetadata:\n  name: my-service\nspec:\n  selector:\n    app: MyApp\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 9376\n  clusterIP: 10.0.171.239\n  loadBalancerIP: 78.11.24.19\n  type: LoadBalancer\nstatus:\n  loadBalancer:\n    ingress:\n    - ip: 146.148.47.155<\/pre>\n\n\n\n<p><em><strong>PS<\/strong><\/em>\uff1a\u6bcf\u4e00\u4e2a\u7528 LoadBalancer \u66b4\u9732\u7684\u670d\u52a1\u90fd\u4f1a\u6709\u5b83\u81ea\u5df1\u7684 IP \u5730\u5740\uff0c\u6bcf\u4e2a\u7528\u5230\u7684 LoadBalancer \u90fd\u9700\u8981\u4ed8\u8d39\uff0c\u8fd9\u5c06\u662f\u6bd4\u8f83\u6602\u8d35\u7684\u82b1\u8d39\u3002\u3000<\/p>\n\n\n\n<p><strong>\u56db\u3001\u5c0f\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u672c\u6587\u4e3b\u8981\u5feb\u901f\u5730\u4e0d\u5b8c\u5168\u5730\u4e0d\u6c42\u751a\u89e3\u5730\u8fc7\u4e86\u4e00\u4e0bK8S\u4e2d\u7684\u4e00\u4e9b\u91cd\u8981\u7684\u57fa\u672c\u6982\u5ff5\uff0c\u76ee\u7684\u662f\u4e3a\u4e0b\u4e00\u7bc7\u90e8\u7f72ASP.NET Core API\u5230K8S\u6709\u4e00\u4e2a\u5fc5\u8981\u7684\u8ba4\u77e5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1ahttps:\/\/www.cnblogs.com\/edisonchou\/p\/aspnet_core_on_ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11767"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11767"}],"version-history":[{"count":3,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11767\/revisions"}],"predecessor-version":[{"id":12037,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11767\/revisions\/12037"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}