Currently able to resolve all services to IP addresses and telnet and ping them. Unable to resolve pods to IP addresses. Though can lookup pod IP addresses with kubectl and telnet and ping them.
How do I need DNS configured to resolve pods in Kubernetes 1.9.6, dns-controller:1.9.1.
Kubernetes Pod DNS Resolution – How to Resolve Issues
internal-dnskubernetes
Related Topic
- Connection timeouts when scaling more than one pod instance in Kubernetes
- Kubernetes – Debugging DNS Resolution Issues
- Kubernetes – Pod /etc/resolv.conf Has Wrong Nameserver
- Kubernetes – Troubleshooting Network Issues in Cluster
- Kubernetes Logs – How Long Kubernetes Stores Pod stdout Logs
- Kubernetes: kube-dns servers are not reachable (other pods are reachable)
Best Answer
@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:
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):
web-{0..N-1}.nginx.default.svc.cluster.local
pod-N.$GOVERNING_STATEFULSET.$NAMESPACE.svc.cluster.local
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
That's one thing that can go wrong. You may want to provide more info about your particular case.