Kubernetes: Pods Can't Resolve Hostnames
I had a similar problem. Restarting the coredns deployment solved it for me:
kubectl -n kube-system rollout restart deployment coredns
Encountered the same issue. I followed this doc dns-debugging-resolution and checked DNS related pods, services, endpoints, all was running without error messages. Finally, I found my calico service was dead. After I started calico service and waited several minutes, It worked.
Some ideas come to mind:
- Maybe the kube-proxy service is not working correctly and hence the kube-dns service is not acccessible. Could you check that it is working?
- You did not install a network overlay correctly, for example Calico: https://docs.projectcalico.org/v2.4/getting-started/kubernetes/installation/hosted/kubeadm/. Did you install it and it is working?