azurekubernetesdnsazure-aksazure-dns

Can I use my azure DNS zone in more than one AKS clusters


I have DNS zone with my domain name and also I have an AKS cluster. I want to create dev and staging environments with two separate clusters. So I want to use same domain with different subdomains in each cluster and integrate it in ingress.


Solution

  • If I understood you correctly, you need something like Exposing Applications on Azure.

    So the idea is to use External DNS + nginx ingress controller. You

    az group create -n devresourcegroup -l yourlocation
    az network dns zone create -g devresourcegroup -n dev.yourdomainname.com
    
    az group create -n stagingresourcegroup -l yourlocation
    az network dns zone create -g stagingresourcegroup -n staging.yourdomainname.com
    

    I suppose external-dns-values.yaml should be like

    dev-external-dns-values.yaml:

    domainFilters:
      - dev.yourdomainname.com          # (optional) Just restrict to this                     
    ...
    azure:
      secretName: azure-config-file     # Secret name created above for dev
    extraArgs:
      azure-resource-group: devresourcegroup  # (Optional) Resource group name created above
    

    staging-external-dns-values.yaml:

    domainFilters:
      - staging.yourdomainname.com     # (optional) Just restrict to this domain
    ...                 
    azure:
      secretName: azure-config-file     # Secret name created above for staging
    extraArgs:
      azure-resource-group: stagingresourcegroup  # (Optional) Resource group name created above
    
    helm install stable/external-dns --name external-dns -f dev-external-dns-values.yaml
    helm install stable/external-dns --name external-dns -f staging-external-dns-values.yaml
    
    spec:
      rules:
      - host: 
        http:
          paths:
          - backend:
              serviceName: 
              servicePort: 
            path: