rancher-sandbox / rancher-desktop

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

Bridged network did not get an IP address #2241

Open flyzstu opened 2 years ago

flyzstu commented 2 years ago

Actual Behavior

Hi, I'm a new user from Docker Desktop to Rancher Desktop. When I start my cluster, it always prompts me: Bridged network did not get an IP address. As follows:

image

I don't know if this is a problem or normal, can someone help me?

Steps to Reproduce

Occurs every time the k3s cluster is started

Result

Bridged network did not get an IP address

Expected Behavior

None

Additional Information

Also a question:Port Forwarding on rancher desktop can not work normally. When I expose a service on K3s, I can access the Pod in the backend of the service through EXTERNAL-IP.

image

But when I use Port Forwarding on rancher desktop , it doesn't work anymore

image

I waited a long time and nothing happened. Using lsof -i to view ports, it's confusing that the port is being used.

image

I don't know if this is related to the problem I mentioned above.

Rancher Desktop Version

1.3.0

Rancher Desktop K8s Version

1.23.6

Which container runtime are you using?

containerd (nerdctl)

What operating system are you using?

macOS

Operating System / Build Version

macOS BigSur 11.6.5

What CPU architecture are you using?

x64

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

No response

Windows User Only

No response

rak-phillip commented 2 years ago

@flyzstu thanks for raising this issue 🙂

Do you recall if you received a sudo prompt? Did you cancel the prompt or enter your password?

From #1937:

We display an explainer dialog right before asking for the sudo password. This dialog should explain that if the password is not provided, Rancher Desktop will run without bridged or shared network interface and can only be accessed via port forwarding from localhost.

flyzstu commented 2 years ago

Thanks for your reply @rak-phillip 😀 I think I have entered the sudo password. But to confirm your statement, I will try to reinstall Rancher-Desktop. How can I solve the problem that Port Forwarding cannot be used?

flyzstu commented 2 years ago

I tried again with sudo access

image-20220522061238913

Start with VM, it prompts me again Bridged network did not get an IP address

image

When I used port forwarding, I have found a question. a. when targetPort set to the port number with Pods, port forwarding works well.

image

b. BUT when targetPort set to the port name with Pods, port forwarding doesn't work any more.

image

I appreciate it if you could say something about it. Thanks you very much.❤️

nadworny commented 2 years ago

same problem here :( the sudo prompt doesn't come up anymore... I tried disabling/enabling, restarting but without success...

Rancher Desktop Version

1.4.1

Rancher Desktop K8s Version

1.23.3 (k8s disabled)

Which container runtime are you using?

dockerd (moby)

What operating system are you using?

macOS

Operating System / Build Version

macOS 12.3.1

What CPU architecture are you using?

m1 aarch64

nadworny commented 2 years ago

re-installing rancher desktop helped with the sudo prompt but I'm still getting that "Bridged network did not..." error 😢

jandubois commented 2 years ago

The "bridged network didn't get an IP address" is not related to the "sudo setting" (except that without "sudo" there will be no bridged or shared network at all).

The bridged (and shared) networks are managed by Apple's vmnet framework, which is responsible for getting an IP address assigned to them.

The bridged network tries to connect to your local network, and tries to obtain an IP address from the DHCP server on that network. So the issue could be that your DHCP server doesn't allow assigning multiple IP addresses to the same MAC address (the VM shares the physical network with the VM in this case).

Or it could be your Wifi access point that doesn't allow this (the Wifi specs strictly speaking don't allow you to have multiple IP addresses for the same adapter, but it does work most of the time/for most access points).

Anyways, my point is that if the bridged network doesn't get an IP address, there is nothing Rancher Desktop can do about it; it is something in your local networking setup that is preventing it.

That's why RD adds a "shared" network as well, which is only used as a fallback when the "bridged" network has no IP. Since the "shared" network is NATed inside the host, it should always be able to get an IP, but it is of course not routable from outside the host because it is behind a NAT.

I'm attaching a chart from our talk about Lima at the last Kubecon. It applies to Rancher Desktop as well, except there is only a single VM (and the network range for the shared network is different).

LimaVdeVmnet

jandubois commented 2 years ago

In a company network it may also be an enforced network policy that prevents you from getting multiple IP addresses for your machine because the company wants to prevent users from adding "illegal switches" to the network.

dee-kryvenko commented 1 year ago

I am also getting this error sometimes. And sometimes I'm not. I can't seem to catch any pattern - looks like a race condition. When I do get that error - eventually my entire network dies, restarting network interfaces doesn't help, and I have to reboot entire machine. I think this might have something to do with either my corporate endpoint protection and/or cisco anyconnect which notoriously setting up additional network interfaces aka Cisco AnyConnect Socket Filter. I did not observe this behavior on any of my personal machines that doesn't have any of that spyware.

That said - if I were to disable Administrative Access - the help tooltip for it reads as it is used for multiple purposes, including the Docker socket compatibility. Can we have a dedicated switch that would disable just the bridged network but keep all the rest of the good stuff that doesn't seem to be broken? Or is it absolutely dependent on the bridged network?

jandubois commented 1 year ago

Docker socket compatibility

You can run docker context use rancher-desktop to point docker to the non-privileged location of the socket, and everything should continue as before.