Kubernetes GKE - DNS propagation very slow

5/1/2018

I have a cluster running on GKE. I have my domain names registered in Cloudflare.

When I add/modify dns entries in Cloudflare, the propagation seems to be very fast (using tools like https://dnschecker.org/). However in my gke cluster, the pods don't resolve the new entries (I have to wait a long long time...). I have tried to add the dns resolver 1.1.1.1 in my kube-dns pods, then I could resolve the new entries in the kube-dns pods (kubedns and dnsmasq) but it still doesn't work for my other pods (the dnspolicy is correctly set to ClusterFirst).

Thanks for your help.

-- matth3o
dns
google-kubernetes-engine
kubernetes

2 Answers

5/6/2018

Thanks for your reply Pol Arroyo.

I found the answer, it has nothing to do with GKE, Cloudflare or a DNS resolver. In fact in my algorithm, I checked before the DNS update if the DNS pointed to the right IP. Doing so, dnsmasq keeped the answer that the DNS doesn't exist and I have to wait its cache to be updated.

-- matth3o
Source: StackOverflow

5/2/2018

You can change the DNS upstream nameservers [1] but keep in mind that DNS propagation can take up to 48h. Here is the example from the documentation:

apiVersion: v1
kind: ConfigMap
metadata:
  name: kube-dns
  namespace: kube-system
data:
  upstreamNameservers: |
    ["1.1.1.1"]

[1] https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#example-upstream-nameserver

-- Pol Arroyo
Source: StackOverflow