Azure Kubernetes Service (AKS) get DNS of your Service

If you have service in AKS and type is LoadBalancer so you may get your DNS also like Firstly in order to use DNS you should have Service type LoadBalancer. If it is type is other you may change it via

 kubectl edit service <yourservicename>

It will create External IP 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:

 kubectl get services --all-namespaces

Then copy External IPĀ  and give below commands via PowerShell

P.S change IP adress with your own external ip address and service name with your own service name

 $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

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

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

So you will get something like this

If you have spesific domain like and you would like to connect your domain to your Azure Kubernetes Service service just follow below link:

Azure Kubernetes Service (AKS) connect servise to custom domain via ingress

Leave a comment

Your email address will not be published.