From 5136f8d55247471f7cc9994231ca6b46230a1ed2 Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Wed, 23 Sep 2020 18:50:02 +0200 Subject: [PATCH] Use apiversion networking.k8s.io/v1 for ingress in ZH version There is a warning deprecation message for kubernetes v1.19: ``` Warning: networking.k8s.io/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress ``` Switched apiversion in the example to `networking.k8s.io/v1` --- .../ingress-minikube.md | 84 ++++++++++--------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/content/zh/docs/tasks/access-application-cluster/ingress-minikube.md b/content/zh/docs/tasks/access-application-cluster/ingress-minikube.md index dab03002d3..16f7b00ea7 100644 --- a/content/zh/docs/tasks/access-application-cluster/ingress-minikube.md +++ b/content/zh/docs/tasks/access-application-cluster/ingress-minikube.md @@ -12,7 +12,7 @@ weight: 100 2. 检查验证 NGINX Ingress 控制器处于运行状态: @@ -104,39 +104,39 @@ This page shows you how to set up a simple Ingress which routes requests to Serv 输出: - + ``` deployment.apps/web created ``` 2. 将 Deployment 暴露出来: ```shell kubectl expose deployment web --type=NodePort --port=8080 ``` - + - 输出: - + 输出: + ``` service/web exposed ``` - 3. 验证 Service 已经创建,并且可能从节点端口访问: ```shell kubectl get service web - ``` - + ``` + 输出: - + ```shell NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE web NodePort 10.104.133.249 8080:31637/TCP 12m @@ -150,14 +150,14 @@ This page shows you how to set up a simple Ingress which routes requests to Serv ```shell minikube service web --url ``` - + 输出: - + ```shell http://172.17.0.15:31637 ``` - + @@ -166,18 +166,18 @@ This page shows you how to set up a simple Ingress which routes requests to Serv 然后点击 **Select port to view on Host 1**。 输入节点和端口号(这里是`31637`),之后点击 **Display Port**。 {{< /note >}} - + 输出: - + ```shell Hello, world! Version: 1.0.0 Hostname: web-55b8c6998d-8k564 ``` - - 你现在应该可以通过 Minikube 的 IP 地址和节点端口来访问示例应用了。 @@ -198,7 +198,7 @@ The following file is an Ingress resource that sends traffic to your Service via 1. 根据下面的 YAML 创建文件 `example-ingress.yaml`: ```yaml - apiVersion: networking.k8s.io/v1beta1 + apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-ingress @@ -210,32 +210,35 @@ The following file is an Ingress resource that sends traffic to your Service via http: paths: - path: / + pathType: Prefix backend: - serviceName: web - servicePort: 8080 + service: + name: web + port: + number: 8080 ``` 2. 通过运行下面的命令创建 Ingress 资源: - + ```shell kubectl apply -f example-ingress.yaml ``` - + 输出: - + ```shell ingress.networking.k8s.io/example-ingress created ``` 3. 验证 IP 地址已被设置: - ```shell + ```shell kubectl get ingress ``` @@ -243,12 +246,12 @@ The following file is an Ingress resource that sends traffic to your Service via {{< note >}}此操作可能需要几分钟时间。{{< /note >}} ```shell - NAME HOSTS ADDRESS PORTS AGE - example-ingress hello-world.info 172.17.0.15 80 38s + NAME CLASS HOSTS ADDRESS PORTS AGE + example-ingress hello-world.info 172.17.0.15 80 38s ``` 4. 在 `/etc/hosts` 文件的末尾添加以下内容: @@ -277,7 +280,7 @@ The following file is an Ingress resource that sends traffic to your Service via 输出: - + ```shell Hello, world! Version: 1.0.0 @@ -305,12 +308,12 @@ The following file is an Ingress resource that sends traffic to your Service via ``` 输出: - + ```shell deployment.apps/web2 created ``` - 2. 将 Deployment 暴露出来: @@ -321,15 +324,15 @@ The following file is an Ingress resource that sends traffic to your Service via 输出: - + ```shell service/web2 exposed ``` - ## 编辑 Ingress @@ -338,9 +341,12 @@ The following file is an Ingress resource that sends traffic to your Service via ```yaml - path: /v2 + pathType: Prefix backend: - serviceName: web2 - servicePort: 8080 + service: + name: web2 + port: + number: 8080 ``` - 输出: + 输出: ```shell ingress.networking/example-ingress configured