Install Nginx Ingress Controller to AKS
In this pos I will show you how you can install Nginx Ingress Controlle to AKS (Azure Kubernetes Service) Cluster.
Parts of the AKS series
- Part1: Install AKS Cluster
- Part2: Integrate AKS with Registry
- Part3: Azure Key Vault AKS integration with akv2k8s
- Part4: Azure Key Vault AKS integration with CSI Driver
- Part5: Install Ingress contreoller To AKS
- Part6: Use Azure Private DNS with AKS Ingress Controller
- Part7: Configure custom SSL and DNS on AKS Ingress Controller
Get AKS credentials
az login
az aks get-credentials --resource-group test-cluster --name test-cluster
kubectl get nodes
Create ingress with static public ip
az network public-ip create \
--location <REGION_NAME> \
--resource-group <RESOURCE_GROUP_NAME> \
--name <IP_NAME> --sku Standard \
--allocation-method static \
--query publicIp.ipAddress -o tsv
# 51.105.230.165
Deploy nginx ingress controller with helm
kubectl create namespace ingress
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install <INGERSS_NAME> \
ingress-nginx/ingress-nginx \
--namespace ingress \
--set controller.replicaCount=2 \
--set controller.nodeSelector."kubernetes\.io/os"=linux \
--set controller.admissionWebhooks.patch.nodeSelector."kubernetes\.io/os"=linux \
--set defaultBackend.nodeSelector."kubernetes\.io/os"=linux \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz \
--set controller.service.loadBalancerIP="51.105.230.165"
kubectl --namespace ingress get services -o wide -w nginx-ingress-controller
kubectl get service -l app=nginx-ingress --namespace ingress
Create an ingress controller to an internal virtual network in
By default, an NGINX ingress controller is created with a dynamic public IP address assignment. A common configuration requirement is to use an internal, private network and IP address. This approach allows you to restrict access to your services to internal users, with no external access. This example assigns 10.240.0.42 to the loadBalancerIP resource.
helm install nginx-ingress \
ingress-nginx/ingress-nginx \
--namespace ingress \
--set controller.ingressClass=internal \
--set controller.replicaCount=2 \
--set controller.nodeSelector."kubernetes\.io/os"=linux \
--set controller.admissionWebhooks.patch.nodeSelector."kubernetes\.io/os"=linux \
--set defaultBackend.nodeSelector."kubernetes\.io/os"=linux \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-internal"=true \
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz \
--set controller.service.loadBalancerIP=10.224.0.42
Create an ingress route
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: hello-world-ingress
namespace: ingress-basic
annotations:
kubernetes.io/ingress.class: internal
...