{"id":58786,"date":"2025-08-16T15:30:25","date_gmt":"2025-08-16T07:30:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/58786.html"},"modified":"2025-08-16T15:30:25","modified_gmt":"2025-08-16T07:30:25","slug":"k8s%e7%9a%84ingress","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/58786.html","title":{"rendered":"K8S\u7684ingress"},"content":{"rendered":"<p>\u4e00\u3002ingress\u7684\u4ecb\u7ecd<\/p>\n<p>\u5bf9\u4e8eNodePort\u548cLoadBalance&#xff0c;\u8fd9\u4e24\u79cd\u65b9\u6cd5&#xff0c;\u90fd\u6709\u7f3a\u70b9&#xff1a;<\/p>\n<p><span style=\"color:#fe2c24\">1.NodePort\u65b9\u5f0f\u7f3a\u70b9\u4f1a\u5360\u7528\u5f88\u591a\u96c6\u7fa4\u7684\u7aef\u53e3&#xff0c;\u5f53\u96c6\u7fa4\u670d\u52a1\u53d8\u591a\u7684\u65f6\u5019&#xff0c;\u7f3a\u70b9\u66f4\u52a0\u663e\u8457<\/span><\/p>\n<p><span style=\"color:#fe2c24\">2.LB\u7684\u7f3a\u70b9\u5c31\u662f\u6bcf\u4e00\u4e2aservice\u90fd\u9700\u8981\u4e00\u4e2aLB&#xff0c;\u6d6a\u8d39&#xff0c;\u9ebb\u70e6&#xff0c;\u5e76\u4e14\u9700\u8981K8S\u4e4b\u5916\u7684\u8bbe\u5907<\/span><\/p>\n<p>\u57fa\u4e8e\u4e0a\u9762\u4e24\u79cd\u60c5\u51b5&#xff0c;K8S\u63d0\u4f9b\u4e86ingress\u8d44\u6e90\u5bf9\u8c61&#xff0c;ingress\u53ea\u9700\u8981\u4e00\u4e2anodeport\u6216\u8005\u4e00\u4e2aLB\u5c31\u53ef\u4ee5\u6ee1\u8db3\u66b4\u9732\u591a\u4e2aservice\u9700\u6c42&#xff0c;\u5b9e\u9645\u4e0a&#xff0c;ingress\u76f8\u5f53\u4e8e\u4e00\u4e2a7\u5c42\u8d1f\u8f7d\u5747\u8861\u5668&#xff0c;\u662fK8S\u5bf9\u53cd\u5411\u4ee3\u7406\u7684\u4e00\u4e2a\u62bd\u8c61&#xff0c;\u4ed6\u7684\u5de5\u4f5c\u539f\u7406\u7c7b\u4f3c\u4e8enginx&#xff0c;\u53ef\u4ee5\u7406\u89e3\u4e3a\u5728ingress\u91cc\u5efa\u7acb\u591a\u4e2a\u6620\u5c04\u89c4\u5219&#xff0c;ingress controller\u901a\u8fc7\u76d1\u542c\u8fd9\u4e9b\u914d\u7f6e\u89c4\u5219\u5e76\u4e14\u8f6c\u5316\u4e3anginx\u53cd\u5411\u4ee3\u7406&#xff0c;\u7136\u540e\u5bf9\u5916\u63d0\u4f9b\u670d\u52a1&#xff0c;\u5728\u8fd9\u674e\u6709\u4e24\u4e2a\u7ed9\u6838\u5fc3\u6982\u5ff5&#xff1a;<\/p>\n<p>1.ingress&#xff1a;K8S\u7684\u4e00\u4e2a\u5bf9\u8c61&#xff0c;\u4f5c\u7528\u662f\u5b9a\u4e49\u8bf7\u6c42\u5982\u4f55\u8f6c\u53d1\u5230service\u7684\u89c4\u5219<\/p>\n<p>2.ingress controller&#xff1a;\u5177\u4f53\u5b9e\u73b0\u53cd\u5411\u4ee3\u7406\u8d1f\u8f7d\u5747\u8861\u7684\u7a0b\u5e8f&#xff0c;\u5bf9ingress\u5b9a\u4e49\u89c4\u5219\u8fdb\u884c\u89e3\u6790&#xff0c;\u6839\u636e\u914d\u7f6e\u7684\u89c4\u5219\u6765\u5b9e\u73b0\u8bf7\u6c42\u8f6c\u53d1&#xff0c;\u4e8b\u9879\u65b9\u5f0f\u5f88\u591a&#xff1a;nginx&#xff0c;haproxy\u7b49<\/p>\n<\/p>\n<p>\u4e8c\u3002Ingress\u7684\u5de5\u4f5c\u539f\u7406&#xff1a;<\/p>\n<p>1.\u7528\u6237\u7f16\u5199ingress\u89c4\u5219&#xff0c;\u8bf4\u660e\u54ea\u4e00\u4e2a\u57df\u5bf9\u5e94K8S\u96c6\u7fa4\u7684\u54ea\u4e00\u4e2a\u670d\u52a1<\/p>\n<p>2.ingress\u63a7\u5236\u5668\u52a8\u6001\u611f\u77e5ingress\u670d\u52a1\u89c4\u5219\u7684\u53d8\u5316&#xff0c;\u7136\u540e\u751f\u6210\u4e00\u6bb5\u76f8\u5e94\u7684nginx\u53cd\u5411\u4ee3\u7406\u914d\u7f6e<\/p>\n<p>3.ingress\u63a7\u5236\u5668\u4f1a\u5c06\u751f\u6210\u7684nginx\u914d\u7f6e\u5199\u5165\u5230\u4e00\u4e2a\u8fd0\u884c\u7740nginx\u7684\u670d\u52a1\u4e2d&#xff0c;\u5e76\u52a8\u6001\u66f4\u65b0<\/p>\n<p>4.\u5230\u6b64\u4e3a\u6b62&#xff0c;\u5176\u5b9e\u771f\u6b63\u7684\u5de5\u4f5c\u5c31\u662fnginx\u4e86&#xff0c;\u5185\u90e8\u914d\u7f6e\u4e86\u7528\u6237\u5b9a\u4e49\u7684\u8bf7\u6c42\u8f6c\u53d1\u89c4\u5219<\/p>\n<\/p>\n<p>\u4e09\u3002\u73af\u5883\u7684\u51c6\u5907&#xff1a;<\/p>\n<p>1.\u4e0b\u8f7d\u914d\u7f6e\u6587\u4ef6&#xff1a;wget -c https:\/\/gitee.com\/kong-xiangyuxcz\/svn\/releases\/download\/ingress-nginx-controller-v1.13.1\/deploy.yaml<\/p>\n<p>445 \u00a0 \u00a0 \u00a0 \u00a0 image: ingress-nginx\/controller:v1.11.2<\/p>\n<p>546 \u00a0 \u00a0 \u00a0 \u00a0 image: ingress-nginx\/kube-webhook-certgen:v1.4.3<\/p>\n<p>599 \u00a0 \u00a0 \u00a0 \u00a0 image: ingress-nginx\/kube-webhook-certgen:v1.4.3<\/p>\n<p>kubectl apply -f deploy.yaml&#xff1a;\u542f\u7528yaml<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"358\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073001-68a03379a2dff.png\" width=\"1516\" \/><\/p>\n<p>kubectl get\u00a0-f deploy.yaml&#xff1a;\u5220\u9664yaml<\/p>\n<\/p>\n<p>\u56db\u3002ingress\u7684\u7528\u6cd5&#xff1a;<\/p>\n<p><span style=\"color:#fe2c24\">\u51c6\u5907\u5de5\u4f5c&#xff1a;<\/span><\/p>\n<p>kubectl create deployment myappv1 &#8211;image nginx:1.17.1 &#8211;dry-run&#061;client -o yaml &gt; myappv1.yaml&#xff1a;\u521b\u5efa\u4e00\u4e2a\u63a7\u5236\u5668<\/p>\n<\/p>\n<p>kubectl create service clusterip myappv1 &#8211;tcp 80:80 &#8211;dry-run&#061;client -o yaml &gt;&gt; myappv1.yaml&#xff1a;\u521b\u5efaservie\u670d\u52a1<\/p>\n<p>&#8211;dry-run&#061;client\u6a21\u62df\u6267\u884c\u547d\u4ee4&#xff08;\u5ba2\u6237\u7aef dry run&#xff09;&#xff0c;\u4e0d\u4f1a\u5b9e\u9645\u521b\u5efa\u670d\u52a1&#xff0c;\u4ec5\u751f\u6210\u914d\u7f6e<\/p>\n<p>\u00a0cp myappv1.yaml myappv2.yaml&#xff1a;\u521b\u5efa\u4e24\u4e2ayaml<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"462\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073004-68a0337c59758.png\" width=\"318\" \/><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"470\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073005-68a0337da42b9.png\" width=\"320\" \/><\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"454\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073007-68a0337f2018d.png\" width=\"1026\" \/><\/p>\n<p>\u4f7f\u7528ingress\u8fdb\u884c\u8d1f\u8f7d\u5747\u8861&#xff1a;<\/p>\n<p>1.\u00a0kubectl -n ingress-nginx get ingressclasses.networking.k8s.io&#xff1a;\u67e5\u770b\u81ea\u5df1\u6240\u5728\u7684\u7c7b<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"118\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073009-68a03381dc97a.png\" width=\"1069\" \/><\/p>\n<p>2.kubectl create ingress ingress-test &#8211;class nginx &#8211;rule&#061;&#034;\/&#061;myappv1:80&#034; &#8211;dry-run&#061;client -o yaml &gt; ingress-test.yml&#xff1a;\u751f\u6210ingress\u6587\u4ef6<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"394\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073010-68a03382f27dc.png\" width=\"443\" \/><\/p>\n<p>3.\u8fdb\u884c\u68c0\u6d4b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"532\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073011-68a03383d8b5e.png\" width=\"1198\" \/><\/p>\n<p>4.\u6d4b\u8bd5&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"91\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073013-68a033858cd2d.png\" width=\"622\" \/><\/p>\n<\/p>\n<p>\u4e94\u3002ingress\u57fa\u4e8e\u8def\u5f84\u7684\u8bbf\u95ee&#xff1a;<\/p>\n<p>1.\u9996\u5148\u5220\u9664\u4ee5\u524d\u7684ingress&#xff0c;\u907f\u514d\u51b2\u7a81&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"165\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073013-68a03385ebd7b.png\" width=\"814\" \/><\/p>\n<p>2.\u521b\u5efa\u57fa\u4e8e\u8def\u5f84\u7684ingress\u6587\u4ef6&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"688\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073014-68a03386f11d0.png\" width=\"646\" \/><\/p>\n<p>3.\u68c0\u6d4b\u7ed3\u679c&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"564\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073015-68a03387bde83.png\" width=\"1093\" \/><\/p>\n<\/p>\n<p>\u516d\u3002\u57fa\u4e8e\u57df\u540d\u7684\u8bbf\u95ee&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"730\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073017-68a033894a109.png\" width=\"730\" \/><\/p>\n<p>\u6d4b\u8bd5&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"109\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073018-68a0338a8c192.png\" width=\"639\" \/><\/p>\n<\/p>\n<p>\u4e03\u3002\u5efa\u7acbtls\u52a0\u5bc6<\/p>\n<p>1.\u5efa\u7acb\u79c1\u94a5\u548c\u8bc1\u4e66&#xff1a;openssl req -newkey rsa:2048 -nodes -keyout tls.key -x509 -days 365 -subj &#034;\/CN&#061;nginxsvc\/0&#061;nginxsvc&#034; -out tls.crt<\/p>\n<p>2.\u5efa\u7acb\u8d44\u6e90\u5b58\u50a8&#xff0c;\u5047\u5982\u96c6\u7fa4&#xff1a;kubectl create secret tls web-tls-secret &#8211;key tls.key &#8211;cert tls.crt<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"400\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073019-68a0338b1641d.png\" width=\"910\" \/><\/p>\n<p>3.\u67e5\u770bsecret\u5185\u5bb9&#xff1a;\u00a0kubectl get secrets web-tls-secret -o yaml<\/p>\n<p>4.\u67e5\u770b\u7c7b\u578b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"121\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073019-68a0338beef1f.png\" width=\"618\" \/><\/p>\n<p>5.\u8fdb\u884c\u914d\u7f6e&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"574\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073020-68a0338c686f0.png\" width=\"940\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"506\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073021-68a0338d87b06.png\" width=\"988\" \/><\/p>\n<p>6.\u6d4b\u8bd5&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"61\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073021-68a0338deeac2.png\" width=\"1161\" \/><\/p>\n<\/p>\n<p>\u4e03\u3002\u5efa\u7acbauth\u8ba4\u8bc1&#xff1a;<\/p>\n<p>1.\u4e0b\u8f7d\u8f6f\u4ef6&#xff1a;\u00a0<\/p>\n<p>dnf install httpd-tools<\/p>\n<p>2.\u5efa\u7acb\u52a0\u5bc6\u7528\u6237<\/p>\n<p>\u00a0htpasswd -cm auth admin<br \/>\n3.\u63d0\u53d6\u5230\u96c6\u7fa4\u7a7a\u95f4&#xff0c;generic\u5b58\u50a8\u4efb\u610f\u952e\u503c\u5bf9\u5f62\u5f0f\u7684\u654f\u611f\u6570\u636e<\/p>\n<p>kubectl create secret generic auth-web &#8211;from-file auth<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"322\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073022-68a0338e8fc64.png\" width=\"739\" \/><\/p>\n<p>4.\u67e5\u770b\u52a0\u5bc6\u8be6\u7ec6\u5185\u5bb9&#xff1a;<\/p>\n<p>kubectl get secrets auth-web -o yaml<\/p>\n<p>5.\u7f16\u5199yml\u6587\u4ef6&#xff1a;<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"571\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073023-68a0338f10947.png\" width=\"1087\" \/><\/p>\n<p>6.\u6d4b\u8bd5&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"115\" src=\"2025-08-16gsmvqig3kcd.png\" width=\"793\" \/><\/p>\n<\/p>\n<p>\u516b&#xff1a;rewirte\u91cd\u5b9a\u5411&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"463\" src=\"2025-08-16qsyhi4pug0g.png\" width=\"664\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"96\" src=\"2025-08-16jqaucosnfrm.png\" width=\"838\" \/><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb388\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf6\u6b21\u30022.kubectl create ingress ingress-test &#8211;class nginx &#8211;rule=&quot;\/=myappv1:80&quot; &#8211;dry-run=client -o yaml &gt; ingress-test.yml\uff1a\u751f\u6210ingress\u6587\u4ef6\u30021.\u5efa\u7acb\u79c1\u94a5\u548c\u8bc1\u4e66\uff1aopenssl req -newkey rsa:2048 -nodes -keyout tls.key -x509 -days 365 -subj &quot;\/CN=nginxsvc\/0=nginxsvc&quot; -out tls.crt\u3002<\/p>\n","protected":false},"author":2,"featured_media":58766,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,120,58],"topic":[],"class_list":["post-58786","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-kubernetes","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>K8S\u7684ingress - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/58786.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"K8S\u7684ingress - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb388\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf6\u6b21\u30022.kubectl create ingress ingress-test --class nginx --rule=&quot;\/=myappv1:80&quot; --dry-run=client -o yaml &gt; ingress-test.yml\uff1a\u751f\u6210ingress\u6587\u4ef6\u30021.\u5efa\u7acb\u79c1\u94a5\u548c\u8bc1\u4e66\uff1aopenssl req -newkey rsa:2048 -nodes -keyout tls.key -x509 -days 365 -subj &quot;\/CN=nginxsvc\/0=nginxsvc&quot; -out tls.crt\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/58786.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-16T07:30:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073001-68a03379a2dff.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/58786.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/58786.html\",\"name\":\"K8S\u7684ingress - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-16T07:30:25+00:00\",\"dateModified\":\"2025-08-16T07:30:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/58786.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/58786.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/58786.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"K8S\u7684ingress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"K8S\u7684ingress - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/58786.html","og_locale":"zh_CN","og_type":"article","og_title":"K8S\u7684ingress - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb388\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf6\u6b21\u30022.kubectl create ingress ingress-test --class nginx --rule=&quot;\/=myappv1:80&quot; --dry-run=client -o yaml &gt; ingress-test.yml\uff1a\u751f\u6210ingress\u6587\u4ef6\u30021.\u5efa\u7acb\u79c1\u94a5\u548c\u8bc1\u4e66\uff1aopenssl req -newkey rsa:2048 -nodes -keyout tls.key -x509 -days 365 -subj &quot;\/CN=nginxsvc\/0=nginxsvc&quot; -out tls.crt\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/58786.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-16T07:30:25+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250816073001-68a03379a2dff.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/58786.html","url":"https:\/\/www.wsisp.com\/helps\/58786.html","name":"K8S\u7684ingress - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-16T07:30:25+00:00","dateModified":"2025-08-16T07:30:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/58786.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/58786.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/58786.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"K8S\u7684ingress"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/58786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=58786"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/58786\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/58766"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=58786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=58786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=58786"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=58786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}