Containers can't resolve hostnames #6168
-
Hello everyone, I am currently running into a problem around connecting to websites from an rke2 container. Whenever I try to connect to a site from inside of a container I receive an unknown host error. for example if I try pinging google.com from a container I get the error:
the resolv.conf file of the pods look like:
and when I run a nslookup on kubernetes.default I get:
the coreDNS config map looks like this:
I've tried restarting the coreDNS deployment, but that has not worked. I am using rke2 version v1.28.10+rke2r1, and it is ran on a Rocky linux 8.10 server. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I found a solution to this problem. If I configure the coreDNS configmap to forward to google's name server (8.8.8.8), the DNS is now able to resolve hostnames. To do this you can edit the configmap with:
and you want to change the data to look something like this
mostly just change the forward from . /etc/resolv.conf to . 8.8.8.8 From there you want to verify that masquerade is on in your fire wall.
if it is not on you can turn it on with:
you can then restart the coreDNS deployment with:
|
Beta Was this translation helpful? Give feedback.
I found a solution to this problem. If I configure the coreDNS configmap to forward to google's name server (8.8.8.8), the DNS is now able to resolve hostnames. To do this you can edit the configmap with:
and you want to change the data to look something like this
mostly just chan…