Skip to content

Commit 5136f8d

Browse files
committed
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`
1 parent 72f0d1d commit 5136f8d

File tree

1 file changed

+45
-39
lines changed

1 file changed

+45
-39
lines changed

content/zh/docs/tasks/access-application-cluster/ingress-minikube.md

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ weight: 100
1212
<!-- overview -->
1313

1414
<!--
15-
An [Ingress](/docs/concepts/services-networking/ingress/) is an API object that defines rules which allow external access
15+
An [Ingress](/docs/concepts/services-networking/ingress/) is an API object that defines rules which allow external access
1616
to services in a cluster. An [Ingress controller](/docs/concepts/services-networking/ingress-controllers/) fulfills the rules set in the Ingress.
1717
1818
This page shows you how to set up a simple Ingress which routes requests to Service web or web2 depending on the HTTP URI.
@@ -65,7 +65,7 @@ This page shows you how to set up a simple Ingress which routes requests to Serv
6565
minikube addons enable ingress
6666
```
6767

68-
<!--
68+
<!--
6969
1. Verify that the NGINX Ingress controller is running
7070
-->
7171
2. 检查验证 NGINX Ingress 控制器处于运行状态:
@@ -104,39 +104,39 @@ This page shows you how to set up a simple Ingress which routes requests to Serv
104104

105105
<!--Output:-->
106106
输出:
107-
107+
108108
```
109109
deployment.apps/web created
110110
```
111111
112112
<!--
113-
1. Expose the Deployment:
113+
1. Expose the Deployment:
114114
-->
115115
2. 将 Deployment 暴露出来:
116116
117117
```shell
118118
kubectl expose deployment web --type=NodePort --port=8080
119119
```
120-
120+
121121
<!-- Output: -->
122-
输出:
123-
122+
输出:
123+
124124
```
125125
service/web exposed
126126
```
127127

128-
<!--
128+
<!--
129129
1. Verify the Service is created and is available on a node port:
130130
-->
131131
3. 验证 Service 已经创建,并且可能从节点端口访问:
132132

133133
```shell
134134
kubectl get service web
135-
```
136-
135+
```
136+
137137
<!-- Output: -->
138138
输出:
139-
139+
140140
```shell
141141
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
142142
web NodePort 10.104.133.249 <none> 8080:31637/TCP 12m
@@ -150,14 +150,14 @@ This page shows you how to set up a simple Ingress which routes requests to Serv
150150
```shell
151151
minikube service web --url
152152
```
153-
153+
154154
<!-- Output: -->
155155
输出:
156-
156+
157157
```shell
158158
http://172.17.0.15:31637
159159
```
160-
160+
161161
<!--
162162
Katacoda environment only: at the top of the terminal panel, click the plus sign, and then click **Select port to view on Host 1**. Enter the NodePort, in this case `31637`, and then click **Display Port**.
163163
-->
@@ -166,18 +166,18 @@ This page shows you how to set up a simple Ingress which routes requests to Serv
166166
然后点击 **Select port to view on Host 1**
167167
输入节点和端口号(这里是`31637`),之后点击 **Display Port**
168168
{{< /note >}}
169-
169+
170170
<!-- Output: -->
171171
输出:
172-
172+
173173
```shell
174174
Hello, world!
175175
Version: 1.0.0
176176
Hostname: web-55b8c6998d-8k564
177177
```
178-
179-
<!--
180-
You can now access the sample app via the Minikube IP address and NodePort. The next step lets you access
178+
179+
<!--
180+
You can now access the sample app via the Minikube IP address and NodePort. The next step lets you access
181181
the app using the Ingress resource.
182182
-->
183183
你现在应该可以通过 Minikube 的 IP 地址和节点端口来访问示例应用了。
@@ -198,7 +198,7 @@ The following file is an Ingress resource that sends traffic to your Service via
198198
1. 根据下面的 YAML 创建文件 `example-ingress.yaml`
199199

200200
```yaml
201-
apiVersion: networking.k8s.io/v1beta1
201+
apiVersion: networking.k8s.io/v1
202202
kind: Ingress
203203
metadata:
204204
name: example-ingress
@@ -210,45 +210,48 @@ The following file is an Ingress resource that sends traffic to your Service via
210210
http:
211211
paths:
212212
- path: /
213+
pathType: Prefix
213214
backend:
214-
serviceName: web
215-
servicePort: 8080
215+
service:
216+
name: web
217+
port:
218+
number: 8080
216219
```
217220
218221
<!--
219222
1. Create the Ingress resource by running the following command:
220223
-->
221224
2. 通过运行下面的命令创建 Ingress 资源:
222-
225+
223226
```shell
224227
kubectl apply -f example-ingress.yaml
225228
```
226-
229+
227230
<!-- Output: -->
228231
输出:
229-
232+
230233
```shell
231234
ingress.networking.k8s.io/example-ingress created
232235
```
233236
<!--
234-
1. Verify the IP address is set:
237+
1. Verify the IP address is set:
235238
-->
236239
3. 验证 IP 地址已被设置:
237240

238-
```shell
241+
```shell
239242
kubectl get ingress
240243
```
241244

242245
<!-- This can take a couple of minutes. -->
243246
{{< note >}}此操作可能需要几分钟时间。{{< /note >}}
244247

245248
```shell
246-
NAME HOSTS ADDRESS PORTS AGE
247-
example-ingress hello-world.info 172.17.0.15 80 38s
249+
NAME CLASS HOSTS ADDRESS PORTS AGE
250+
example-ingress <none> hello-world.info 172.17.0.15 80 38s
248251
```
249252

250253
<!--
251-
1. Add the following line to the bottom of the `/etc/hosts` file.
254+
1. Add the following line to the bottom of the `/etc/hosts` file.
252255
-->
253256
4.`/etc/hosts` 文件的末尾添加以下内容:
254257

@@ -277,7 +280,7 @@ The following file is an Ingress resource that sends traffic to your Service via
277280

278281
<!-- Output: -->
279282
输出:
280-
283+
281284
```shell
282285
Hello, world!
283286
Version: 1.0.0
@@ -305,12 +308,12 @@ The following file is an Ingress resource that sends traffic to your Service via
305308
```
306309
<!-- Output: -->
307310
输出:
308-
311+
309312
```shell
310313
deployment.apps/web2 created
311314
```
312315

313-
<!--
316+
<!--
314317
1. Expose the Deployment:
315318
-->
316319
2. 将 Deployment 暴露出来:
@@ -321,15 +324,15 @@ The following file is an Ingress resource that sends traffic to your Service via
321324

322325
<!-- Output: -->
323326
输出:
324-
327+
325328
```shell
326329
service/web2 exposed
327330
```
328331

329-
<!--
332+
<!--
330333
## Edit Ingress
331334
332-
1. Edit the existing `example-ingress.yaml` and add the following lines:
335+
1. Edit the existing `example-ingress.yaml` and add the following lines:
333336
-->
334337
## 编辑 Ingress
335338

@@ -338,9 +341,12 @@ The following file is an Ingress resource that sends traffic to your Service via
338341

339342
```yaml
340343
- path: /v2
344+
pathType: Prefix
341345
backend:
342-
serviceName: web2
343-
servicePort: 8080
346+
service:
347+
name: web2
348+
port:
349+
number: 8080
344350
```
345351
346352
<!--
@@ -353,7 +359,7 @@ The following file is an Ingress resource that sends traffic to your Service via
353359
```
354360

355361
<!-- Output: -->
356-
输出:
362+
输出:
357363

358364
```shell
359365
ingress.networking/example-ingress configured

0 commit comments

Comments
 (0)