February 6, 2021 - Patrick Kerwood
This is a guide on installing a NGINX Ingress controller on Azure Kubernetes Service.
A prerequisite for installing NGINX Ingress with Helm is of course Helm. Go to the Helm install docs (opens new window) and get a piece of that cake.
Efter installing Helm, add the ingress-nginx
repo and update your Helm repositories.
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
Create a namespace in your cluster.
kubectl create namespace ingress-nginx
Run below command to install. This will create a load balancer resource with a public IP, in the AKS shadow resource group.
helm install ingress-nginx ingress-nginx/ingress-nginx \
--namespace ingress-nginx \
--set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
--set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux \
--set controller.service.type=LoadBalancer \
--set controller.service.externalTrafficPolicy=Local
If you want to use a specific public IP resource in a resource group, append below lines to your install command. The first line is the actual IPv4 address you want to use and the second line is the name of the resource group where the public ip resource is located.
...
--set controller.service.loadBalancerIP=<ip-address> \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-resource-group"=<resource-group-name>
You also have the option to only make the load balancer available in your internal Vnet, by creating an internal load balancer. The load balancer will get an IP address from the Vnet.
...
--set-string controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-internal"="true"
After deploying the ingress controller, you can verify that the load balancer is ensured. It might take some time depending on your provider.
$ kubectl describe service ingress-nginx-controller --namespace ingress-nginx
...
Normal EnsuredLoadBalancer 2m32s service-controller Ensured load balancer