Skip to content

Commit 3639d82

Browse files
authored
Merge pull request #38273 from tengqm/normalize-ingress-minikube
Format markdown on the ingress-minikube page
2 parents 93ab5d3 + 0366957 commit 3639d82

File tree

1 file changed

+103
-81
lines changed

1 file changed

+103
-81
lines changed

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

Lines changed: 103 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@ min-kubernetes-server-version: 1.19
77

88
<!-- overview -->
99

10-
An [Ingress](/docs/concepts/services-networking/ingress/) is an API object that defines rules which allow external access
11-
to services in a cluster. An [Ingress controller](/docs/concepts/services-networking/ingress-controllers/) fulfills the rules set in the Ingress.
12-
13-
This page shows you how to set up a simple Ingress which routes requests to Service web or web2 depending on the HTTP URI.
14-
10+
An [Ingress](/docs/concepts/services-networking/ingress/) is an API object that defines rules
11+
which allow external access to services in a cluster. An
12+
[Ingress controller](/docs/concepts/services-networking/ingress-controllers/)
13+
fulfills the rules set in the Ingress.
1514

15+
This page shows you how to set up a simple Ingress which routes requests to Service 'web' or
16+
'web2' depending on the HTTP URI.
1617

1718
## {{% heading "prerequisites" %}}
1819

19-
2020
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
21-
If you are using an older Kubernetes version, switch to the documentation
22-
for that version.
23-
21+
If you are using an older Kubernetes version, switch to the documentation for that version.
2422

2523
### Create a Minikube cluster
2624

@@ -37,49 +35,60 @@ Locally
3735

3836
1. To enable the NGINX Ingress controller, run the following command:
3937

40-
```shell
41-
minikube addons enable ingress
42-
```
38+
```shell
39+
minikube addons enable ingress
40+
```
4341

4442
1. Verify that the NGINX Ingress controller is running
4543

4644

4745
{{< tabs name="tab_with_md" >}}
4846
{{% tab name="minikube v1.19 or later" %}}
49-
```shell
50-
kubectl get pods -n ingress-nginx
51-
```
52-
{{< note >}}It can take up to a minute before you see these pods running OK.{{< /note >}}
47+
48+
```shell
49+
kubectl get pods -n ingress-nginx
50+
```
51+
52+
{{< note >}}
53+
It can take up to a minute before you see these pods running OK.
54+
{{< /note >}}
5355

5456
The output is similar to:
5557

56-
```
57-
NAME READY STATUS RESTARTS AGE
58-
ingress-nginx-admission-create-g9g49 0/1 Completed 0 11m
59-
ingress-nginx-admission-patch-rqp78 0/1 Completed 1 11m
60-
ingress-nginx-controller-59b45fb494-26npt 1/1 Running 0 11m
61-
```
58+
```none
59+
NAME READY STATUS RESTARTS AGE
60+
ingress-nginx-admission-create-g9g49 0/1 Completed 0 11m
61+
ingress-nginx-admission-patch-rqp78 0/1 Completed 1 11m
62+
ingress-nginx-controller-59b45fb494-26npt 1/1 Running 0 11m
63+
```
6264
{{% /tab %}}
65+
6366
{{% tab name="minikube v1.18.1 or earlier" %}}
64-
```shell
65-
kubectl get pods -n kube-system
66-
```
67-
{{< note >}}It can take up to a minute before you see these pods running OK.{{< /note >}}
67+
68+
```shell
69+
kubectl get pods -n kube-system
70+
```
71+
72+
{{< note >}}
73+
It can take up to a minute before you see these pods running OK.
74+
{{< /note >}}
6875

6976
The output is similar to:
7077

71-
```
72-
NAME READY STATUS RESTARTS AGE
73-
default-http-backend-59868b7dd6-xb8tq 1/1 Running 0 1m
74-
kube-addon-manager-minikube 1/1 Running 0 3m
75-
kube-dns-6dcb57bcc8-n4xd4 3/3 Running 0 2m
76-
kubernetes-dashboard-5498ccf677-b8p5h 1/1 Running 0 2m
77-
nginx-ingress-controller-5984b97644-rnkrg 1/1 Running 0 1m
78-
storage-provisioner 1/1 Running 0 2m
79-
```
80-
81-
Make sure that you see a Pod with a name that starts with `nginx-ingress-controller-`.
78+
```none
79+
NAME READY STATUS RESTARTS AGE
80+
default-http-backend-59868b7dd6-xb8tq 1/1 Running 0 1m
81+
kube-addon-manager-minikube 1/1 Running 0 3m
82+
kube-dns-6dcb57bcc8-n4xd4 3/3 Running 0 2m
83+
kubernetes-dashboard-5498ccf677-b8p5h 1/1 Running 0 2m
84+
nginx-ingress-controller-5984b97644-rnkrg 1/1 Running 0 1m
85+
storage-provisioner 1/1 Running 0 2m
86+
```
87+
88+
Make sure that you see a Pod with a name that starts with `nginx-ingress-controller-`.
89+
8290
{{% /tab %}}
91+
8392
{{< /tabs >}}
8493

8594
## Deploy a hello, world app
@@ -92,7 +101,7 @@ storage-provisioner 1/1 Running 0 2m
92101

93102
The output should be:
94103

95-
```
104+
```none
96105
deployment.apps/web created
97106
```
98107

@@ -104,19 +113,19 @@ storage-provisioner 1/1 Running 0 2m
104113

105114
The output should be:
106115

107-
```
116+
```none
108117
service/web exposed
109118
```
110119

111120
1. Verify the Service is created and is available on a node port:
112121

113-
```shell
122+
```shell
114123
kubectl get service web
115124
```
116125

117126
The output is similar to:
118127

119-
```
128+
```none
120129
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
121130
web NodePort 10.104.133.249 <none> 8080:31637/TCP 12m
122131
```
@@ -129,26 +138,31 @@ storage-provisioner 1/1 Running 0 2m
129138

130139
The output is similar to:
131140

132-
```
141+
```none
133142
http://172.17.0.15:31637
134143
```
135144

136-
{{< note >}}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**.{{< /note >}}
145+
{{< note >}}
146+
Katacoda environment only: at the top of the terminal panel, click the plus sign,
147+
and then click **Select port to view on Host 1**. Enter the NodePort value,
148+
in this case `31637`, and then click **Display Port**.
149+
{{< /note >}}
137150

138151
The output is similar to:
139152

140-
```
153+
```none
141154
Hello, world!
142155
Version: 1.0.0
143156
Hostname: web-55b8c6998d-8k564
144157
```
145158

146-
You can now access the sample app via the Minikube IP address and NodePort. The next step lets you access
147-
the app using the Ingress resource.
159+
You can now access the sample application via the Minikube IP address and NodePort.
160+
The next step lets you access the application using the Ingress resource.
148161

149162
## Create an Ingress
150163

151-
The following manifest defines an Ingress that sends traffic to your Service via hello-world.info.
164+
The following manifest defines an Ingress that sends traffic to your Service via
165+
`hello-world.info`.
152166

153167
1. Create `example-ingress.yaml` from the following file:
154168

@@ -162,7 +176,7 @@ The following manifest defines an Ingress that sends traffic to your Service via
162176

163177
The output should be:
164178

165-
```
179+
```none
166180
ingress.networking.k8s.io/example-ingress created
167181
```
168182

@@ -172,42 +186,49 @@ The following manifest defines an Ingress that sends traffic to your Service via
172186
kubectl get ingress
173187
```
174188

175-
{{< note >}}This can take a couple of minutes.{{< /note >}}
189+
{{< note >}}
190+
This can take a couple of minutes.
191+
{{< /note >}}
176192

177-
You should see an IPv4 address in the ADDRESS column; for example:
193+
You should see an IPv4 address in the `ADDRESS` column; for example:
178194

179-
```
195+
```none
180196
NAME CLASS HOSTS ADDRESS PORTS AGE
181197
example-ingress <none> hello-world.info 172.17.0.15 80 38s
182198
```
183199

184200
1. Add the following line to the bottom of the `/etc/hosts` file on
185201
your computer (you will need administrator access):
186202

187-
```
203+
```none
188204
172.17.0.15 hello-world.info
189205
```
190206
191-
{{< note >}}If you are running Minikube locally, use `minikube ip` to get the external IP. The IP address displayed within the ingress list will be the internal IP.{{< /note >}}
207+
{{< note >}}
208+
If you are running Minikube locally, use `minikube ip` to get the external IP.
209+
The IP address displayed within the ingress list will be the internal IP.
210+
{{< /note >}}
192211
193-
After you make this change, your web browser sends requests for
194-
hello-world.info URLs to Minikube.
212+
After you make this change, your web browser sends requests for
213+
`hello-world.info` URLs to Minikube.
195214
196215
1. Verify that the Ingress controller is directing traffic:
197216
198-
```shell
199-
curl hello-world.info
200-
```
217+
```shell
218+
curl hello-world.info
219+
```
201220

202-
You should see:
221+
You should see:
203222

204-
```
205-
Hello, world!
206-
Version: 1.0.0
207-
Hostname: web-55b8c6998d-8k564
208-
```
223+
```none
224+
Hello, world!
225+
Version: 1.0.0
226+
Hostname: web-55b8c6998d-8k564
227+
```
209228

210-
{{< note >}}If you are running Minikube locally, you can visit hello-world.info from your browser.{{< /note >}}
229+
{{< note >}}
230+
If you are running Minikube locally, you can visit `hello-world.info` from your browser.
231+
{{< /note >}}
211232

212233
## Create a second Deployment
213234

@@ -216,9 +237,10 @@ The following manifest defines an Ingress that sends traffic to your Service via
216237
```shell
217238
kubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0
218239
```
240+
219241
The output should be:
220242

221-
```
243+
```none
222244
deployment.apps/web2 created
223245
```
224246

@@ -230,7 +252,7 @@ The following manifest defines an Ingress that sends traffic to your Service via
230252

231253
The output should be:
232254

233-
```
255+
```none
234256
service/web2 exposed
235257
```
236258

@@ -240,13 +262,13 @@ The following manifest defines an Ingress that sends traffic to your Service via
240262
following lines at the end:
241263

242264
```yaml
243-
- path: /v2
244-
pathType: Prefix
245-
backend:
246-
service:
247-
name: web2
248-
port:
249-
number: 8080
265+
- path: /v2
266+
pathType: Prefix
267+
backend:
268+
service:
269+
name: web2
270+
port:
271+
number: 8080
250272
```
251273
252274
1. Apply the changes:
@@ -257,7 +279,7 @@ The following manifest defines an Ingress that sends traffic to your Service via
257279

258280
You should see:
259281

260-
```
282+
```none
261283
ingress.networking/example-ingress configured
262284
```
263285

@@ -271,7 +293,7 @@ The following manifest defines an Ingress that sends traffic to your Service via
271293

272294
The output is similar to:
273295

274-
```
296+
```none
275297
Hello, world!
276298
Version: 1.0.0
277299
Hostname: web-55b8c6998d-8k564
@@ -285,16 +307,16 @@ The following manifest defines an Ingress that sends traffic to your Service via
285307

286308
The output is similar to:
287309

288-
```
310+
```none
289311
Hello, world!
290312
Version: 2.0.0
291313
Hostname: web2-75cd47646f-t8cjk
292314
```
293315

294-
{{< note >}}If you are running Minikube locally, you can visit hello-world.info and hello-world.info/v2 from your browser.{{< /note >}}
295-
296-
297-
316+
{{< note >}}
317+
If you are running Minikube locally, you can visit `hello-world.info` and
318+
`hello-world.info/v2` from your browser.
319+
{{< /note >}}
298320

299321
## {{% heading "whatsnext" %}}
300322

0 commit comments

Comments
 (0)