You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/aks/ingress-basic.md
+85-32Lines changed: 85 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ titleSuffix: Azure Kubernetes Service
4
4
description: Learn how to install and configure a basic NGINX ingress controller in an Azure Kubernetes Service (AKS) cluster.
5
5
services: container-service
6
6
ms.topic: article
7
-
ms.date: 12/20/2019
7
+
ms.date: 04/27/2020
8
8
9
9
---
10
10
@@ -23,7 +23,7 @@ You can also:
23
23
24
24
## Before you begin
25
25
26
-
This article uses [Helm 3][helm] to install the NGINX ingress controller and a sample web app.
26
+
This article uses [Helm 3][helm] to install the NGINX ingress controller.
27
27
28
28
This article also requires that you are running the Azure CLI version 2.0.64 or later. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][azure-cli-install].
29
29
@@ -37,7 +37,7 @@ The ingress controller also needs to be scheduled on a Linux node. Windows Serve
37
37
> The following example creates a Kubernetes namespace for the ingress resources named *ingress-basic*. Specify a namespace for your own environment as needed.
38
38
39
39
> [!TIP]
40
-
> If you would like to enable [client source IP preservation][client-source-ip] for requests to containers in your cluster, add `--set controller.service.externalTrafficPolicy=Local` to the Helm install command. The client source IP is stored in the request header under *X-Forwarded-For*. When using an ingress controller with client source IP preservation enabled, TLS pass-through will not work.
40
+
> If you would like to enable [client source IP preservation][client-source-ip] for requests to containers in your cluster, add `--set controller.service.externalTrafficPolicy=Local` to the Helm install command. The client source IP is stored in the request header under *X-Forwarded-For*. When using an ingress controller with client source IP preservation enabled, SSL pass-through will not work.
41
41
42
42
```console
43
43
# Create a namespace for your ingress resources
@@ -68,34 +68,96 @@ No ingress rules have been created yet, so the NGINX ingress controller's defaul
68
68
69
69
## Run demo applications
70
70
71
-
To see the ingress controller in action, let's run two demo applications in your AKS cluster. In this example, Helm is used to deploy two instances of a simple *Hello world* application.
71
+
To see the ingress controller in action, run two demo applications in your AKS cluster. In this example, you use `kubectl apply` to deploy two instances of a simple *Hello world* application.
72
72
73
-
Before you can install the sample Helm charts, add the Azure samples repository to your Helm environment as follows:
73
+
Create a *aks-helloworld-one.yaml* file and copy in the following example YAML:
Now install a second instance of the demo application. For the second instance, you specify a new title so that the two applications are visually distinct. You also specify a unique service name:
149
+
Run the two demo applications using `kubectl apply`:
Both applications are now running on your Kubernetes cluster. To route traffic to each application, create a Kubernetes ingress resource. The ingress resource configures the rules that route traffic to one of the two applications.
97
159
98
-
In the following example, traffic to *EXTERNAL_IP* is routed to the service named `aks-helloworld`. Traffic to *EXTERNAL_IP/hello-world-two* is routed to the `aks-helloworld-two` service. Traffic to *EXTERNAL_IP/static* is routed to the service named `aks-helloworld` for static assets.
160
+
In the following example, traffic to *EXTERNAL_IP* is routed to the service named `aks-helloworld-one`. Traffic to *EXTERNAL_IP/hello-world-two* is routed to the `aks-helloworld-two` service. Traffic to *EXTERNAL_IP/static* is routed to the service named `aks-helloworld-one` for static assets.
99
161
100
162
Create a file named `hello-world-ingress.yaml` and copy in the following example YAML.
101
163
@@ -114,7 +176,7 @@ spec:
114
176
- http:
115
177
paths:
116
178
- backend:
117
-
serviceName: aks-helloworld
179
+
serviceName: aks-helloworld-one
118
180
servicePort: 80
119
181
path: /(.*)
120
182
- backend:
@@ -136,7 +198,7 @@ spec:
136
198
- http:
137
199
paths:
138
200
- backend:
139
-
serviceName: aks-helloworld
201
+
serviceName: aks-helloworld-one
140
202
servicePort: 80
141
203
path: /static(/|$)(.*)
142
204
```
@@ -172,12 +234,6 @@ To delete the entire sample namespace, use the `kubectl delete` command and spec
172
234
kubectl delete namespace ingress-basic
173
235
```
174
236
175
-
Then, remove the Helm repo for the AKS hello world app:
176
-
177
-
```console
178
-
helm repo remove azure-samples
179
-
```
180
-
181
237
### Delete resources individually
182
238
183
239
Alternatively, a more granular approach is to delete the individual resources created. List the Helm releases with the `helm list` command. Look for charts named *nginx-ingress* and *aks-helloworld*, as shown in the following example output:
@@ -186,25 +242,22 @@ Alternatively, a more granular approach is to delete the individual resources cr
186
242
$ helm list --namespace ingress-basic
187
243
188
244
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
Delete the releases with the `helm delete` command. The following example deletes the NGINX ingress deployment, and the two sample AKS hello world apps.
248
+
Uninstall the releases with the `helm uninstall` command. The following example uninstalls the NGINX ingress deployment.
0 commit comments