Score:0

Kubernete Pod cannot resolve DNS address but can reach it (example curl google.com fails, curl ip is ok)

ng flag

I'm just starting out and i've been learning kubernetes since couple of weeks ago, i'm using a plain installation of microk8's with addons dns metallb enabled, and a simple pod with alpine with curl pkg added to make some tests.

Everything works fine, deployments, nodes, comunication within pods from same namespaces as well as other namespaces. But i cannot reach internet within a pod using dns name. for example:

curl google.com -> curl: (7) Failed to connect to google.com port 80 after 14 ms: Couldn't connect to server

while

curl 142.250.184.78 -> OK

Same goes for ping command, with the strange add that it resolves the dns google.com in 127.0.0.1:

ping google.com -> 64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.030 ms

while

ping 142.250.184.78 -> 64 bytes from 142.250.184.78: seq=0 ttl=114 time=8.997 ms

I really don't know where to go, i've tried looking into calico for kubernetes but i just can't figure it out myself, any help is appreciated.

Setup Used: Dedicated machine with Ubuntu 22.04.1 inside a home-network Out of the box microk8s installation with just dns metallb addon Simple container with curl pkg installed

Score:0
ng flag

In the end it was a problem of dns. Kubernetes was trying to resolve a dns inside /etc/resolv.conf it was something like 'homenettelecom.com' which dunno why it couldn't let me out of the network. Upon removing it everything started working properly. Also had to remove the symlink for /etc/resolv.conf because some application (i suppose also kubernetes) was constantly re-applying that conifg.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.