I have added one more nameserver and also rotate options so that for dns resolution, different name servers are picked using round robin fashion but it's picking first name server always. This is my resolv.conf
nameserver 10.96.0.10
nameserver 8.8.8.8
search measurement.svc.cluster.local svc.cluster.local cluster.local
options rotate timeout:1 ndots:5
Second nameserver is never getting picked. I tried running nslookup from kuberenetes pod multiple times. It's always picking first one and that's some cluster level default. Is there some additional configuration change required at k8s level or it has something to do with Coredns policy? I would really appreciate any help.
When you specify multiple name servers in
resolv.conffile with options rotate, the resolver library should rotate through each name server in order for each DNS query. However in your case, the second nameserver is being ignored.This issue could be caused by several factors:
Check if the second nameserver is configured correctly and is reachable.
Ensure the network connectivity is not an issue and check network configuration and firewall settings.
The issue might be caused by DNS caching also. The first name server could be cached and the resolver library might be using a cached response instead of rotating to the next server. Clear the DNS cache to see if it resolves the issue.
Also, try to increase the timeout value in options timeout : 3 or 5 seconds. The first server might be responding faster than the second server, so the resolver library is continuously using the first one.