Why can't my pods resolve DNS?
When pods cannot resolve DNS, test a cluster name from inside a pod first. The result shows whether the problem is in the cluster or upstream of it:
kubectl exec <pod> -- nslookup kubernetes.default.svc.cluster.local
- The cluster name fails or times out. Check that the CoreDNS pods in
kube-systemare running and that thekube-dnsService has endpoints. Then check your network policies. A policy that denies all egress also blocks DNS, so allow UDP and TCP port 53 to CoreDNS. - Cluster names resolve, external names do not. The problem is upstream of CoreDNS. CoreDNS forwards external names to the node's resolvers:
1.1.1.1and8.8.8.8by default, or the servers in thednsServerscluster variable if you set it. Check that those resolvers answer. - AAAA lookups for cluster names come back empty. This is expected, because pods and Services are IPv4-only.
Syself Autopilot runs CoreDNS and scales it with the cluster, so you do not manage its replica count. If CoreDNS stays unhealthy, prepare a support case.
The commands and the policy rule for port 53 are in Diagnose pod DNS resolution. To change the upstream resolvers, see Understand in-cluster DNS (CoreDNS).
Related questions
