armaan mahajan
armaan mahajan

Reputation: 1

Pod is not able to connect to internet

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

Upvotes: 0

Views: 6549

Answers (1)

Ahsan Nasir
Ahsan Nasir

Reputation: 147

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.

Upvotes: 2

Related Questions