Skip to content

Commit af7e2ad

Browse files
Added instructions for MacOS and Windows that enable accessing services using minikube tunnel.
Co-authored-by: Dipesh Rawat <[email protected]>
1 parent 80aa5f5 commit af7e2ad

File tree

1 file changed

+175
-21
lines changed

1 file changed

+175
-21
lines changed

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

Lines changed: 175 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ This page shows you how to set up a simple Ingress which routes requests to Serv
2020
This tutorial assumes that you are using `minikube` to run a local Kubernetes cluster.
2121
Visit [Install tools](/docs/tasks/tools/#minikube) to learn how to install `minikube`.
2222

23+
{{< note >}}
24+
This tutorial uses a container that requires the AMD64 architecture.
25+
If you are using minikube on a computer with a different CPU architecture,
26+
you could try using minikube with a driver that can emulate AMD64.
27+
For example, the Docker Desktop driver can do this.
28+
{{< /note >}}
29+
2330
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
2431
If you are using an older Kubernetes version, switch to the documentation for that version.
2532

@@ -70,6 +77,21 @@ If you haven't already set up a cluster locally, run `minikube start` to create
7077
```none
7178
deployment.apps/web created
7279
```
80+
81+
Verify that the Deployment is in a Ready state:
82+
83+
```shell
84+
kubectl get deployment web
85+
```
86+
87+
The output should be similar to:
88+
89+
```none
90+
NAME READY UP-TO-DATE AVAILABLE AGE
91+
web 1/1 1 1 53s
92+
```
93+
94+
7395

7496
1. Expose the Deployment:
7597

@@ -96,22 +118,40 @@ If you haven't already set up a cluster locally, run `minikube start` to create
96118
web NodePort 10.104.133.249 <none> 8080:31637/TCP 12m
97119
```
98120

99-
1. Visit the Service via NodePort:
121+
1. Visit the Service via NodePort, using the [`minikube service`](https://minikube.sigs.k8s.io/docs/handbook/accessing/#using-minikube-service-with-tunnel) command. Follow the instructions for your platform:
100122

123+
{{< tabs name="minikube_service" >}}
124+
{{% tab name="Linux" %}}
125+
101126
```shell
102127
minikube service web --url
103128
```
104-
105129
The output is similar to:
106-
107130
```none
108131
http://172.17.0.15:31637
109132
```
110-
133+
Invoke the URL obtained in the output of the previous step:
111134
```shell
112135
curl http://172.17.0.15:31637
113136
```
114-
137+
{{% /tab %}}
138+
{{% tab name="MacOS" %}}
139+
```shell
140+
# The command must be run in a separate terminal.
141+
minikube service web --url
142+
```
143+
The output is similar to:
144+
```none
145+
http://127.0.0.1:62445
146+
! Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
147+
```
148+
From a different terminal, invoke the URL obtained in the output of the previous step:
149+
```shell
150+
curl http://127.0.0.1:62445
151+
```
152+
{{% /tab %}}
153+
{{< /tabs >}}
154+
<br>
115155
The output is similar to:
116156

117157
```none
@@ -162,12 +202,46 @@ The following manifest defines an Ingress that sends traffic to your Service via
162202
```
163203

164204

165-
1. Verify that the Ingress controller is directing traffic:
205+
1. Verify that the Ingress controller is directing traffic, by following the instructions for your platform:
206+
207+
{{< note >}}
208+
The network is limited if using the Docker driver on MacOS (Darwin) and the Node IP is not reachable directly. To get ingress to work you’ll need to open a new terminal and run `minikube tunnel`.
209+
`sudo` permission is required for it, so provide the password when prompted.
210+
{{< /note >}}
211+
212+
213+
{{< tabs name="ingress" >}}
214+
{{% tab name="Linux" %}}
166215

167216
```shell
168217
curl --resolve "hello-world.info:80:$( minikube ip )" -i http://hello-world.info
169218
```
219+
{{% /tab %}}
220+
{{% tab name="MacOS" %}}
221+
222+
```shell
223+
minikube tunnel
224+
```
225+
The output is similar to:
226+
227+
```none
228+
Tunnel successfully started
229+
230+
NOTE: Please do not close this terminal as this process must stay alive for the tunnel to be accessible ...
231+
232+
The service/ingress example-ingress requires privileged ports to be exposed: [80 443]
233+
sudo permission will be asked for it.
234+
Starting tunnel for service example-ingress.
235+
```
170236

237+
From within a new terminal, invoke the following command:
238+
```shell
239+
curl --resolve "hello-world.info:80:127.0.0.1" -i http://hello-world.info
240+
```
241+
242+
{{% /tab %}}
243+
{{< /tabs >}}
244+
<br>
171245
You should see:
172246

173247
```none
@@ -176,25 +250,36 @@ The following manifest defines an Ingress that sends traffic to your Service via
176250
Hostname: web-55b8c6998d-8k564
177251
```
178252

179-
You can also visit `hello-world.info` from your browser.
253+
1. Optionally, you can also visit `hello-world.info` from your browser.
180254

181-
* **Optionally**
182-
Look up the external IP address as reported by minikube:
183-
```shell
184-
minikube ip
185-
```
186-
187-
Add line similar to the following one to the bottom of the `/etc/hosts` file on
255+
Add a line to the bottom of the `/etc/hosts` file on
188256
your computer (you will need administrator access):
189257

190-
```none
191-
172.17.0.15 hello-world.info
192-
```
193-
194-
{{< note >}}
195-
Change the IP address to match the output from `minikube ip`.
196-
{{< /note >}}
258+
{{< tabs name="hosts" >}}
259+
{{% tab name="Linux" %}}
260+
Look up the external IP address as reported by minikube
261+
```none
262+
minikube ip
263+
```
264+
<br>
197265

266+
```none
267+
172.17.0.15 hello-world.info
268+
```
269+
270+
{{< note >}}
271+
Change the IP address to match the output from `minikube ip`.
272+
{{< /note >}}
273+
{{% /tab %}}
274+
{{% tab name="MacOS" %}}
275+
```none
276+
127.0.0.1 hello-world.info
277+
```
278+
{{% /tab %}}
279+
{{< /tabs >}}
280+
281+
<br>
282+
198283
After you make this change, your web browser sends requests for
199284
`hello-world.info` URLs to Minikube.
200285

@@ -211,6 +296,18 @@ The following manifest defines an Ingress that sends traffic to your Service via
211296
```none
212297
deployment.apps/web2 created
213298
```
299+
Verify that the Deployment is in a Ready state:
300+
301+
```shell
302+
kubectl get deployment web2
303+
```
304+
305+
The output should be similar to:
306+
307+
```none
308+
NAME READY UP-TO-DATE AVAILABLE AGE
309+
web2 1/1 1 1 16s
310+
```
214311

215312
1. Expose the second Deployment:
216313

@@ -255,9 +352,38 @@ The following manifest defines an Ingress that sends traffic to your Service via
255352

256353
1. Access the 1st version of the Hello World app.
257354

355+
{{< tabs name="ingress2-v1" >}}
356+
{{% tab name="Linux" %}}
357+
258358
```shell
259359
curl --resolve "hello-world.info:80:$( minikube ip )" -i http://hello-world.info
260360
```
361+
{{% /tab %}}
362+
{{% tab name="MacOS" %}}
363+
364+
```shell
365+
minikube tunnel
366+
```
367+
The output is similar to:
368+
369+
```none
370+
Tunnel successfully started
371+
372+
NOTE: Please do not close this terminal as this process must stay alive for the tunnel to be accessible ...
373+
374+
The service/ingress example-ingress requires privileged ports to be exposed: [80 443]
375+
sudo permission will be asked for it.
376+
Starting tunnel for service example-ingress.
377+
```
378+
379+
From within a new terminal, invoke the following command:
380+
```shell
381+
curl --resolve "hello-world.info:80:127.0.0.1" -i http://hello-world.info
382+
```
383+
384+
{{% /tab %}}
385+
{{< /tabs >}}
386+
<br>
261387

262388
The output is similar to:
263389

@@ -269,9 +395,37 @@ The following manifest defines an Ingress that sends traffic to your Service via
269395

270396
1. Access the 2nd version of the Hello World app.
271397

398+
{{< tabs name="ingress2-v2" >}}
399+
{{% tab name="Linux" %}}
400+
272401
```shell
273402
curl --resolve "hello-world.info:80:$( minikube ip )" -i http://hello-world.info/v2
274403
```
404+
{{% /tab %}}
405+
{{% tab name="MacOS" %}}
406+
407+
```shell
408+
minikube tunnel
409+
```
410+
The output is similar to:
411+
412+
```none
413+
Tunnel successfully started
414+
415+
NOTE: Please do not close this terminal as this process must stay alive for the tunnel to be accessible ...
416+
417+
The service/ingress example-ingress requires privileged ports to be exposed: [80 443]
418+
sudo permission will be asked for it.
419+
Starting tunnel for service example-ingress.
420+
```
421+
422+
From within a new terminal, invoke the following command:
423+
```shell
424+
curl --resolve "hello-world.info:80:127.0.0.1" -i http://hello-world.info/v2
425+
```
426+
427+
{{% /tab %}}
428+
{{< /tabs >}}
275429

276430
The output is similar to:
277431

0 commit comments

Comments
 (0)