How to apply custom domain name to azure kubernetes services (AKS) cluster?

1/20/2021

I have a AKS cluster with default FQDN name with the suffix of "cloudapp.azure.com". I want to get a domain and apply it to the cluster but am not sure how to apply custom domain to Kubernetes cluster in azure.

Can anyone help me with the steps to apply custom domain name to AKS cluster?

-- Harish Darne
azure
kubernetes

2 Answers

1/20/2021

Azure won't provide you the DNS names, but it has a service named as DNS zone, where you can register your custom domain ( that you may have from providers like GoDaddy etc ), the externalIP of the ingress or any other load balancer that you see in the AKS clusters can be mapped to this custom domain name in the DNS zone and this will take the traffic to the respective AKS cluster.

Advantage of DNS zone is that, you can enter multiple alias URLs as well and can make them to take traffic to AKS cluster, like

abc.com is your domain ( let's say )

api.abc.com is for mobile applications to communicate with AKS and this can be pointed to same URL via CNames in DNS zone.

You can have multiple options here based on your usecase, refer Azure's documentation on DNS zones for that

-- Tushar Mahajan
Source: StackOverflow

1/22/2021

If I understand you correctly, you've already deployed your application on Kubernetes and want to connect it to your custom domain name.

For this purpose you can use NGINX Ingress Controller.

Below I will briefly describe how you can do it on AKS:

  1. First you need to create an ingress controller and ingress resource. For Azure AKS detailed instructions can be found here: create-an-ingress-controller.
    Note: By default, the public IP address acquired by NGINX Ingress is lost if the controller is deleted. I recommend you to create static public IP address, because it remains if the ingress controller is deleted.
  2. Next identify the public IP address (EXTERNAL-IP) associated with your NGINX Ingress service that was created in the previous step.
  3. Now you need to create an A DNS record, to point your domain to the cluster. Additionally you may want to provide CNAME record, but is isn't mandatory and depends on your needs.<br>It is possible to create Azure DNS Zone for your custom domain and then add appropriate record sets to this zone.
    Note: Azure DNS is not the domain registrar, you have to configure the Azure DNS name servers as the correct name servers for the domain name with the domain name registrar. For more information, see Delegate a domain to Azure DNS.
-- matt_j
Source: StackOverflow