<p>I'm trying to setup a K8 ingress to route to multiple services based on the hostname. Like mentioned <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#name-based-virtual-hosting" rel="nofollow noreferrer">here.</a></p>

<p>In Azure, I'm able to map DNS name with Public IP using <code>az-cli</code> like this,</p>

<pre><code>az network public-ip update --ids $PUBLICIPID --dns-name $DNSNAME
</code></pre>

<p>However, this command isn't letting me to add multiple DNS entries to the same publicIP.</p>

<p>What will be the right way to achieve this in Azure KS? Preferably using <code>az-cli</code> or some other <code>cli</code> tools.</p>

Prasanna
<p>I dont think you can assign multiple Azure managed DNS names to the same public IP, but you can use <a href="https://learn.microsoft.com/en-us/azure/dns/dns-operations-recordsets-cli#create-a-dns-record" rel="nofollow noreferrer">Azure DNS</a> or some external DNS provider to have as many CNAME records pointing to the same DNS record as you want to.</p>

<pre><code>az network dns record-set cname set-record --resource-group myresourcegroup --zone-name contoso.com --record-set-name test-cname --cname www.contoso.com
</code></pre>

<p>an alternative would be to use <a href="https://github.com/kubernetes-sigs/external-dns" rel="nofollow noreferrer">external dns</a> to let kubernetes manage it.</p>
