๐
DNS not resolving in cluster or from pod
Service name fails, external DNS wrong, or CoreDNS unhealthy.
Reviewed: ยทTested on: Kubernetes 1.29, Terraform 1.8, Ubuntu 22.04
Symptoms
- Could not resolve host from inside pod
- Intermittent NXDOMAIN for cluster services
- External DNS points to wrong IP
1Test from a debug pod
kubectl run dnscheck --rm -it --image=busybox:1.36 --restart=Never -- nslookup kubernetes.default
kubectl run dnscheck --rm -it --image=busybox:1.36 --restart=Never -- nslookup <service>.<ns>.svc.cluster.local2Check CoreDNS
kubectl get pods -n kube-system -l k8s-app=kube-dns
kubectl logs -n kube-system -l k8s-app=kube-dns --tail=50
kubectl get configmap coredns -n kube-system -o yaml3Ingress / external DNS
dig app.example.com +short
kubectl get ingress -n <ns>
# compare ingress ADDRESS to dig result