What it means
Pods resolve names through CoreDNS at the address in their /etc/resolv.conf. Short names only work inside the same namespace; other namespaces need name.namespace.
Causes and fixes
Most likely first. Run the check, and if it matches, apply the fix.
1. Wrong name or namespace (my-svc from another namespace)
Check:
kubectl exec <pod> -- nslookup my-svc.<ns>.svc.cluster.local
Fix: Use name.namespace or the full name.
2. The Pod's dnsPolicy or dnsConfig overrides cluster DNS
Check:
kubectl exec <pod> -- cat /etc/resolv.conf
Fix: Use dnsPolicy ClusterFirst unless there's a reason not to.
3. A NetworkPolicy blocks egress to CoreDNS on port 53
Check:
kubectl get networkpolicy -n <ns>
Fix: Allow egress to kube-dns (UDP and TCP 53).
4. CoreDNS itself is down or misconfigured
Check:
kubectl -n kube-system get pods -l k8s-app=kube-dns; kubectl -n kube-system logs -l k8s-app=kube-dns
Fix: Fix the Corefile or the CoreDNS Deployment.
Fix it yourself
A live machine in your browser with this problem already on it. The grader checks the result.
Open the labNo account needed for your first tries.
Related errors
- Service has no endpoints
The Service exists, but its selector matches no ready Pods, so connections fail.