
Production notebook
Azure Kubernetes Service (AKS) + nginx-ingress with Static IP
A concise archive of assigning a stable public address to an nginx ingress controller on AKS.
Credit: Growtika (Unsplash)
Coming from a GCP background, it was straightforward to set static IPs for nginx-ingress-powered clusters on GKE using the kubernetes.io/ingress.global-static-ip-name annotation.
However, there is not much documentation on how to do this on Azure Kubernetes Service (AKS), hence this short document.
Steps
1. Create the Public IP Address on Azure Portal with your cluster’s resource group

2. Install nginx-ingress and set the loadBalancerIP to the IP you've created in step 1
STATIC_IP=<your static IP here>
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx \
--create-namespace \
--set rbac.create=true \
--set controller.stats.enabled=true \
--set controller.metrics.enabled=true \
--set controller.service.externalTrafficPolicy="Local" \
--set controller.service.loadBalancerIP=$STATIC_IP3. Monitor the new LoadBalancer resource. The static IP from step 1 should show up after a few seconds

Other Notes
- If you use
kubectlto installnginx-ingress, you can simply update the load balancer IP in theingress-nginx-controllerservice’sspec.loadBalancerIP - There is a way to specify a custom resource group, but this is the most straightforward way to do it since we’re adjusting the public IP to follow the k8s cluster instead of the other way around