For the past few days, I have been trying to follow the steps of this tutorial in order to set up Nginx with external-dns in an Azure Kubernetes Cluster.
Everything looks alright until I try to reach my sample pod via my new subdomain in the last step of the tutorial.
curl sample.<my domain> -v
Eventually fails after 2 minutes (connection timed out), but the right ip address of the node balancer is resolved at least.
Here are the steps I have been doing, if you want to follow along: https://zerobin.org/?3189aa0a24fbfbb7#rVQe86mgxmgRymqXtMP1N1JJuBGQTd4v4kwgjpCKCBu
I added log level 5 to the Nginx pod
containers:
- name: controller
image: >-
registry.k8s.io/ingress-nginx/controller:v1.9.1@sha256:605a737877de78969493a4b1213b21de4ee425d2926906857b98050f57a95b25
args:
- /nginx-ingress-controller
- --v=5
The logs seem to indicate that an immediate 404 error is produced, I am also not faithful that the right ip address is used to forward the request.
So I retrieved the nginx.conf from the pod but it is very complex and autogenerated and I can't really judge if this is correct.
At this point, I would really appreciate the support of someone who has experience with Nginx...



Okay, after some consulting with other developers, who encountered the same issue, I was able to get this working. It seems like this configuration currently needs one ingress rule without a host definition to work. This has the drawback of exposing one service directly via the IP address, but if it concerns you, you can just put a dummy there. If you do want to provide this host-less ingress rule with a DNS entry you can use the following annotation:
Finally, here is an alternative sample-app.yaml that defines an otherwise redundant (apart from that it makes this setup work) hostless-rule. Further pods & subdomains can be added as usual via host, you only need one hostless-rule in your cluster.