Note: I’m going to have to list the steps I think I took to buy a domain name on the Azure Portal, as I didn’t note all the steps down at the time – so please double check things when creating your own.
You can create you domain wherever you like, I happened to have decided to create mine via Azure.
- Go to the Azure portal
- Search for DNS Zones and click the Create button
- Supply your subscription and resource group
- Select your domain name
- Click the Review + Create then create to DNS Zone
To set up the DNS zone (I cannot recall if this was part of the above or a separate step), run
az network dns zone create \
--resource-group {RESOURCE_GROUP} \
--name {DOMAN_NAME}
I’m going to assume you have Kubernetes installed.
We need a way to get from the outside world into our Kubernetes cluster so we’ll create and ingress controller using
helm install ingress-nginx ingress-nginx/ingress-nginx \ --create-namespace --namespace ingress-nginx \ --set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz \ --set controller.service.externalTrafficPolicy=Local
Next we need to update our DNS record to use the EXTERNAL_IP of the ingress controller we’ve just created, so
- Run the following to get the EXTERNAL_IP
kubectl get svc ingress-nginx-controller -n ingress-n
- You can go into the DNS record and change the A record (@ Type and any other subdomains you’ve added) to use the EXTERNAL_IP address or use
az network dns record-set a add-record --resource-group {RESOURCE_GROUP} \ --zone-name {DOMAIN_NAME} --record-set-name --ipv4-address {EXTERNAL_IP}
At this point you’ll obviously need to set up your service with it’s own ingress using your domain in the “host” value of the ingress.