rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.82k stars 272 forks source link

Cannot resolve domains outside of k8s network! #6316

Open BoKKeR opened 7 months ago

BoKKeR commented 7 months ago

Actual Behavior

I am expecting the domains outside of the kubernetes network to be reachable from the cluster.

Steps to Reproduce

I run the following curl image which has worked on different clusters!

kubectl run -it --rm --restart=Never busybox --image=yauritux/busybox-curl -- curl https://www.google.com

Result

curl: (6) Could not resolve host: www.google.com
pod "busybox" deleted
pod ciam-dev/busybox terminated (Error)

Expected Behavior

The expected behaviour is being able to ping and use websites outside of my cluster

Additional Information

I am not running any proxy, this has been a problem for a year on my home network. Sometimes it works, sometimes it does not. I am running pi-hole but the problem was present before I added pi-hole! I can resolve google on the host.

The problem has been coming and going since rancher desktop 1.5, I am unable to fix it myself unfortunately.

➜  ~ kubectl run -it --rm --restart=Never --namespace=ciam-dev busybox --image=yauritux/busybox-curl -- cat /etc/hosts 
# Kubernetes-managed hosts file.
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.42.0.20  busybox
pod "busybox" deleted
➜  ~ kubectl run -it --rm --restart=Never busybox --image=yauritux/busybox-curl -- cat /etc/resolv.conf                (rancher-desktop/default)
nameserver 10.43.0.10
search default.svc.cluster.local svc.cluster.local cluster.local local
options ndots:5
pod "busybox" deleted

The containers seem to work if I add an external dns manually!

/home # curl google.com
curl: (6) Could not resolve host: google.com
/home # echo nameserver 8.8.8.8 >> /etc/resolv.conf
/home # curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
/home # 

Rancher Desktop Version

1.11.1

Rancher Desktop K8s Version

v1.27.9

Which container engine are you using?

moby (docker cli)

What operating system are you using?

macOS

Operating System / Build Version

Sonoma 14.2.1 (23C71)

What CPU architecture are you using?

arm64 (Apple Silicon)

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

BoKKeR commented 7 months ago

I am ready to help out with the triage! I can also be found on the slack channel, I posted about this issue