Pod hosted on K8s cluster is not able to connect to the internet:
[root@master micro-services]# kubectl exec -it webapp-77896f4bf8-8ptbb -- ping google.com
ping: bad address 'google.com'
command terminated with exit code 1
You can check the name servers by opening resolv.conf
in your container's directory:
/etc/resolv.conf
You can test by adding Google's public name server like:
nameserver 8.8.8.8
Should resolve internet issue by adding above line to /etc/resolv.conf
.
A better way is to use Kubernetes's own core DNS as described here.