There's a slightly easier way to achieve the same, and is to use:
service:
annotations: service.beta.kubernetes.io/azure-dns-label-name: "mycustomdnsname"
in the service definition of the ingress controller (the helm command becomes like:
helm install stable/nginx-ingress --namespace kube-system --set controller.replicaCount=2 --set service.annotations[0]="service.beta.kubernetes.io/azure-dns-label-name: mycustomdnsname"
This way you can skip the section here and just use then mycustomdnsname.westeurope.cloudapp.azure.com
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for the feedback! I have assigned the issue to the content author to investigate further and update the document as appropriate.
Thanks for the feedback, @ams0. Is the DNS name also then updated on the corresponding public IP address resource created in Azure? What if a static public IP address was pre-created, is the DNS record added to that existing Azure resource?
@sauryadas Is this annotation supported for use in AKS?
This sounds swell, but I'm not getting it to work. Since this issue have been dormant for a while now, I'm wondering if this ought to work still, or if I'm missing something?
Legend @ams0 exactly what I was looking for and verified working today
@lindhe It didn't seem to work for me if I was adding the annotation to an existing deployment of nginx-ingress (maybe doesn't update the Public IP resource?) but worked when I created a new deployment
I am still facing issues. I am unable to create Public IP with DNS using
helm install stable/nginx-ingress --namespace kube-system --set controller.replicaCount=2 --set service.annotations[0]="service.beta.kubernetes.io/azure-dns-label-name: mycustomdnsname"
My AKS is in eastus2
Seems like the key in values.yaml changed slightly, now called controller.service.annotations. I am deploying nginx-ingress with Helm3 now with this:
kubectl create ns ingress
#took forever to figure out
helm install nginx-ingress stable/nginx-ingress \
--namespace ingress \
--set controller.replicaCount=2 \
--set controller.service.annotations."service\.beta\.kubernetes\.io\/azure-load-balancer-internal"=true \
--set controller.service.annotations."service\.beta\.kubernetes\.io\/azure-dns-label-name"=internal \
--set controller.metrics.enabled=true \
--set controller.stats.enabled=true
This seems to not work again. I've tried the exact helm install from above and it didn't set the DNS label name in my resources. Where do I find the documentation for all annotations that are supported with examples? I can't find this definitive list anywhere in documentation.
This is working for me but can you tell me where can I see the DNS entry that my ingress service gets after putting this annotation. I am able to access my service on <label>.<zone>.cloudapp.azure.com but just wanted to check the corresponding dns entry. Also wanted to understand why can't it resolve subhosts like <label2>.<label>.<zone>.cloudapp.azure.com. In A type DNS records, it is generally possible to resolve subhosts.
Most helpful comment
Seems like the key in
values.yamlchanged slightly, now calledcontroller.service.annotations. I am deploying nginx-ingress with Helm3 now with this: