Skip to content

Commit 061557b

Browse files
authored
Merge pull request #47838 from rohancragg/patch-2
Configure Helm release to ensure DNS name persists
2 parents 69a45ea + f8aa0d6 commit 061557b

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

articles/aks/ingress-static-ip.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ Next, create a public IP address with the *static* allocation method using the [
4646
az network public-ip create --resource-group MC_myResourceGroup_myAKSCluster_eastus --name myAKSPublicIP --sku Standard --allocation-method static --query publicIp.ipAddress -o tsv
4747
```
4848

49-
Now deploy the *nginx-ingress* chart with Helm. Add the `--set controller.service.loadBalancerIP` parameter, and specify your own public IP address created in the previous step. For added redundancy, two replicas of the NGINX ingress controllers are deployed with the `--set controller.replicaCount` parameter. To fully benefit from running replicas of the ingress controller, make sure there's more than one node in your AKS cluster.
49+
Now deploy the *nginx-ingress* chart with Helm. For added redundancy, two replicas of the NGINX ingress controllers are deployed with the `--set controller.replicaCount` parameter. To fully benefit from running replicas of the ingress controller, make sure there's more than one node in your AKS cluster.
50+
51+
You must pass two additional parameters to the Helm release so the ingress controller is made aware both of the static IP address of the load balancer to be allocated to the ingress controller service, and of the DNS name label being applied to the public IP address resource. For the HTTPS certificates to work correctly, a DNS name label is used to configure an FQDN for the ingress controller IP address.
52+
53+
1. Add the `--set controller.service.loadBalancerIP` parameter. Specify your own public IP address that was created in the previous step.
54+
1. Add the `--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-dns-label-name"` parameter. Specify a DNS name label to be applied to the public IP address that was created in the previous step.
5055

5156
The ingress controller also needs to be scheduled on a Linux node. Windows Server nodes (currently in preview in AKS) shouldn't run the ingress controller. A node selector is specified using the `--set nodeSelector` parameter to tell the Kubernetes scheduler to run the NGINX ingress controller on a Linux-based node.
5257

@@ -56,6 +61,8 @@ The ingress controller also needs to be scheduled on a Linux node. Windows Serve
5661
> [!TIP]
5762
> 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.
5863
64+
Update the following script with the **IP address** of your ingress controller and a **unique name** that you would like to use for the FQDN prefix:
65+
5966
```console
6067
# Create a namespace for your ingress resources
6168
kubectl create namespace ingress-basic
@@ -67,6 +74,7 @@ helm install nginx-ingress stable/nginx-ingress \
6774
--set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
6875
--set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux \
6976
--set controller.service.loadBalancerIP="40.121.63.72"
77+
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-dns-label-name"="demo-aks-ingress"
7078
```
7179

7280
When the Kubernetes load balancer service is created for the NGINX ingress controller, your static IP address is assigned, as shown in the following example output:
@@ -81,27 +89,14 @@ nginx-ingress-default-backend ClusterIP 10.0.95.248 <none>
8189

8290
No ingress rules have been created yet, so the NGINX ingress controller's default 404 page is displayed if you browse to the public IP address. Ingress rules are configured in the following steps.
8391

84-
## Configure a DNS name
85-
86-
For the HTTPS certificates to work correctly, configure an FQDN for the ingress controller IP address. Update the following script with the IP address of your ingress controller and a unique name that you would like to use for the FQDN:
92+
You can verify that the DNS name label has been applied by querying the FQDN on the public IP address as follows:
8793

8894
```azurecli-interactive
8995
#!/bin/bash
90-
91-
# Public IP address of your ingress controller
92-
IP="40.121.63.72"
93-
94-
# Name to associate with public IP address
95-
DNSNAME="demo-aks-ingress"
96-
97-
# Get the resource-id of the public ip
98-
PUBLICIPID=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[id]" --output tsv)
99-
100-
# Update public ip address with DNS name
101-
az network public-ip update --ids $PUBLICIPID --dns-name $DNSNAME
96+
az network public-ip list --resource-group MC_myResourceGroup_myAKSCluster_eastus --query $("[?name=='myAKSPublicIP'].[dnsSettings.fqdn]") -o tsv
10297
```
10398

104-
The ingress controller is now accessible through the FQDN.
99+
The ingress controller is now accessible through the IP address or the FQDN.
105100

106101
## Install cert-manager
107102

0 commit comments

Comments
 (0)