How to deploy nginx-ingress controller in a private Azure Kubernetes & Private ACR.
- VNET with 2 subnets (Enable Service Endpoint)
- Private Azure Container Registry (networking blade should be on Disabled) provisioned in the other repo: https://github.com/andyxuan2010/AIonK8sDemo
- Private AKS with RBAC enabled (Attach AKS cluster to registry) provisioned in the other repo: https://github.com/andyxuan2010/AIonK8sDemo
- Linux Jumpbox with Azure CLI, Docker, Helm (v 3.7.0), Kubernetes CLI installed, provisioned in the other repo: https://github.com/andyxuan2010/AIonK8sDemo
The environment can be provisioned either by terraform code or by script. Here is the steps to create the environment by scripts
- Setup your infrastructure for your Private environment (refer to Create VM-steps)
- Create Private Azure Container Registry (refer to createregistry-steps.sh)
- Create Private AKS (refer to createaks-steps.sh) if by terraform, refer it to the other repo https://github.com/andyxuan2010/AIonK8sDemo which will provision all the required environment.
- From Linux VM, authenticate with your registry and run az acr import to import all necessary images/repositories into the container registry (make sure you have Azure CLI, Docker, Helm (v 3.7.0), Kubernetes CLI installed )
- Download desired package for ingress-nginx (Im using version 3.36.0)
- Extract .tgz file and run helm push to acr (refer to manual.sh steps for commands)
- Authenticate with your ACR and make sure helm pull runs successfully before running helm upgrade command
- Create AKS namespace for ingress controller
- Create internal-ingress.yaml file to create ingress controller and specify an ip that is not been used inside your vnet (use the internal-ingress.yaml inside ingress folder on this repo for reference)
- Run helm upgrade (Refer to manual.sh for commands)
- Run demo applications (aks-helloworld.yaml and ingress-demo.yaml) by running kubectl apply from linux vm
- Run kubectl get validatingwebhookconfigurations and Delete it (kubectl delete validatingwebhookconfigurations nameoftheWebhook)
- Create an ingress route (deploy hello-world-ingress.yaml)
- Validate and test ingress controller by running the following:
a. kubectl run -it --rm aks-ingress-test --image=mcr.microsoft.com/aks/fundamental/base-ubuntu:v0.0.11 -n yournamespace
b. apt-get update && apt-get install -y curl
c. curl -L http://youripgivenfortheinternalloadbalancer and curl -L -k http://yourip/hello-world-two
d. You can also open a browser in a vm with access to this vnet and you should see your ingress working