google-kubernetes-enginecloudflarekubernetes-ingressexternal-dns

Cloudflare External DNS and CNAME vs A records


I am trying to configure Kubernetes tool for automatically configuring Cloudflare external DNS.

There are two configuration options:

external-dns.alpha.kubernetes.io/hostname: nginx.hostname.net
external-dns.alpha.kubernetes.io/target: nginx.hostname.net

Filling the target leads to creating CNAME records, leaving it empty leads to creating A records. I have had some bad experiences with messages like DNS_PROBE_FINISHED_NXDOMAIN and server IP address could not be found when using CNAME, so I want to use A records.

However when this is left out, the tool generates an A record with the nginx-ingress, however that IP is not accessible from the outside world and the correct IP is the one of the LoadBalancer which stands in front of the nginx-ingress.

One solution is to manually write the LoadBalancer IP to the target field, however that is not very nice to manually write it there.

So what am I doing wrong? How to make the tool to use the LoadBalancer IP instead of the Ingress one?


Solution

  • Actually the original issue was caused by:

    https://github.com/kubernetes-sigs/external-dns/issues/992

    Upgrading the external-dns helped and I can now correctly use the CNAME method:

    external-dns.alpha.kubernetes.io/target: nginx.hostname.net