Kubernetes Pod DNS Resolution

@mk_sta 's answer a bit easier to work with you can run this one liner to test your DNS:

kubectl run busybox --image=busybox --rm --attach --command -- sh -c "cat /etc/resolv.conf; nslookup $POD.$NAMESPACE.pod.cluster.local"

Example output:

If you don't see a command prompt, try pressing enter.


*** Can't find $POD.$NAMESPACE.pod.cluster.local: No answer

deployment.apps "busybox" deleted

Bonus is that it deletes the deployment/pods after running.

For me the problem was that my pods are in a statefulset and therefore Pod DNS resolution is a bit different. You have to use (for example):




That's one thing that can go wrong. You may want to provide more info about your particular case.