Skip to content

Instantly share code, notes, and snippets.

@pavlovmilen
Last active August 10, 2023 16:24
Show Gist options
  • Save pavlovmilen/97595f51a9039e7441028cd398828840 to your computer and use it in GitHub Desktop.
Save pavlovmilen/97595f51a9039e7441028cd398828840 to your computer and use it in GitHub Desktop.
Azure AKS add nginx ingress with Lets encrypt Cluster Issuer how to guide
  1. Create IP address az network public-ip create --resource-group resources_ml-aks-uks_ml-aks-uks --name pip-ml-aks-uks --sku Standard --allocation-method static --query publicIp.ipAddress -o ts

  2. Create a namespace for your ingress resources kubectl create namespace nginx-ingress

  3. Add the official stable repository helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm repo add stable https://charts.helm.sh/stable
    helm repo update

helm install ingress-nginx ingress-nginx/ingress-nginx
--namespace nginx-ingress
--set controller.replicaCount=2
--set controller.nodeSelector."beta.kubernetes.io/os"=linux
--set defaultBackend.nodeSelector."beta.kubernetes.io/os"=linux
--set controller.service.externalTrafficPolicy=Local
--set controller.service.loadBalancerIP="20.68.25.47"

  1. Cert manager namespace kubectl create namespace cert-manager

  2. Get the Helm Chart for Cert Manager helm repo add jetstack https://charts.jetstack.io helm repo update

  3. Install Cert Manager using Helm charts helm install cert-manager jetstack/cert-manager --namespace cert-manager --set installCRDs=true

  4. Create a ClusterIssuer yaml file

kind: ClusterIssuer
metadata:
  name: letsencrypt-production
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: email here
    privateKeySecretRef:
      name: letsencrypt-production
    solvers:
      - http01:
          ingress:
            class: nginx

kubectl apply -f cluster-issuer.yaml

9. Integrate with ACR 
az aks update -n myAKSCluster -g myResourceGroup --attach-acr <acr-name>

10. Dont forget to use letsencrypt-production in the app ingress yaml file !!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment