<p>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.</p>

Ruben Aleksanyan
<p>If I understood you correctly, you need something like <a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html" rel="nofollow noreferrer">Exposing Applications on Azure</a>.</p>
<p>So the idea is to use <code>External DNS</code> + <code>nginx ingress controller</code>.
You</p>
<ul>
<li><a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#create-aks-cluster" rel="nofollow noreferrer">Create 2 AKS clusters</a></li>
<li><a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#create-dns-zone-entry" rel="nofollow noreferrer">Create 2 DNS zones entries</a></li>
</ul>
<pre><code>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
</code></pre>
<ul>
<li><a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#create-dns-zone-entry" rel="nofollow noreferrer">create</a>  dev.yourdomainname.com and staging.yourdomainname.com entries</li>
<li><a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#add-permissions-to-modify-dns-zone" rel="nofollow noreferrer">add permissions to modify dns zone for external-dns</a></li>
<li><a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#deploy-external-dns" rel="nofollow noreferrer">deploy externaldns in both clusters</a></li>
</ul>
<p>I <strong>suppose</strong> <code>external-dns-values.yaml</code> should be like</p>
<p><code>dev-external-dns-values.yaml</code>:</p>
<pre><code>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
</code></pre>
<p><code>staging-external-dns-values.yaml</code>:</p>
<pre><code>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
</code></pre>
<ul>
<li>Install <a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#deploy-external-dns" rel="nofollow noreferrer">external-dns</a>'es</li>
</ul>
<pre><code>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
</code></pre>
<ul>
<li><p><a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#deploy-nginx-ingress" rel="nofollow noreferrer">Install Ingress controllers</a></p>
</li>
<li><p><a href="https://playbook.stakater.com/content/processes/exposing/azure-cluster-with-aws-subdomain.html#deploying-application" rel="nofollow noreferrer">deploy apps</a> with proper ingress objects in each cluster. I mean this part</p>
</li>
</ul>
<pre><code>spec:
  rules:
  - host: 
    http:
      paths:
      - backend:
          serviceName: 
          servicePort: 
        path: 
</code></pre>
