I am encountering an issue with Kubernetes where my pods cannot resolve hostnames (such as google.com
or kubernetes.default
).
I currently have
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.
I had a similar problem. Restarting the coredns deployment solved it for me:
kubectl -n kube-system rollout restart deployment coredns
Some ideas come to mind:
Check coredns pods log, if you see errors like:
# kubectl logs --namespace=kube-system coredns-XXX
...
[ERROR] plugin/errors ... HINFO: read udp ... read: no route to host
Then make sure firewalld masquerade is enabled on the host:
# firewall-cmd --list-all
...
masquerade: yes
Enable if it's "no":
# firewall-cmd --add-masquerade --permanent
# firewall-cmd --reload
*You may need to restart/reboot after this