<p>I have a kubernetes service running on Azure. After the deployment and service are created, the service publishes an External-IP address and I am able to access the service on that IP:Port.</p>

<p>However, I want to access the service through a regular domain name. I know that the kubernetes cluster running on Azure has its own DNS, but how can I figure out what the service DNS name is???</p>

<p>I am running multiple services, and they refer to one another using the &lt;_ServiceName>.&lt;_Namespace>.svc.cluster.local naming convention, but if I attempt to access the Service using &lt;_ServiceName>.&lt;_Namespace>.svc.&lt;_kubernetesDNS>.&lt;_location>.azureapp.com, it doesnt work.</p>

<p>Any help would be greatly appreciated.</p>

<p>Firstly in order to use DNS you should have Service type LoadBalancer. It will create ExternalIp for your service. So if you have and Service which type is LoadBalancer you may  take your external IP address of service with below command:</p>

<pre><code>kubectl get services --all-namespaces
</code></pre>

<p>Then copy external ip and give below commands via PowerShell</p>

<p>P.S change IP adress with your own external ip address and service name with your own service name</p>

<pre><code>$IP="23.101.60.87"
$DNSNAME="yourservicename-aks"
$PUBLICIPID=az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[id]" --output tsv
az network public-ip update --ids $PUBLICIPID --dns-name $DNSNAME
</code></pre>

<p>So after this commands just give command below via PowerShell again, it will show you your DNS:</p>

<pre><code>az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[dnsSettings.fqdn]" -o table
</code></pre>

<p>Reference: <a href="http://alakbarv.azurewebsites.net/2019/01/25/azure-kubernetes-service-aks-get-dns-of-your-service/" rel="nofollow noreferrer">http://alakbarv.azurewebsites.net/2019/01/25/azure-kubernetes-service-aks-get-dns-of-your-service/</a></p>
