rancher-sandbox / rancher-desktop

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

Kubernetes fails to start on Windows 10 (corporate envrionment with proxy). #2695

Open brubrz opened 2 years ago

brubrz commented 2 years ago

Actual Behavior

Kubernetes fails to start.

Steps to Reproduce

Hard, because it depends on user vpn setup.

Result

Error Starting Kubernetes

TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"

Context: Waiting for nodes

recent logfile:

}
2022-08-08T07:38:56.431Z: Waited more than 60 secs for nerdctl images to succeed. Giving up.
2022-08-08T07:38:56.431Z: Running: wsl.exe --distribution rancher-desktop --exec /sbin/rc-update --update
2022-08-08T07:38:56.598Z: Running: wsl.exe --distribution rancher-desktop --exec /usr/local/bin/wsl-service k3s start
2022-08-08T07:39:08.832Z: Capturing output: wsl.exe --distribution rancher-desktop --exec cat /proc/net/route
2022-08-08T07:39:08.966Z: Capturing output: wsl.exe --distribution rancher-desktop --exec cat /proc/net/fib_trie
2022-08-08T07:39:30.169Z: Capturing output: wsl.exe --distribution rancher-desktop --exec /bin/sh -c if test -r /etc/rancher/k3s/k3s.yaml; then echo yes; else echo no; fi
2022-08-08T07:39:30.310Z: Capturing output: wsl.exe --distribution rancher-desktop --exec wslpath -a -u C:\Users\user\AppData\Local\Programs\Rancher Desktop\resources\resources\linux\wsl-helper
2022-08-08T07:39:30.472Z: Capturing output: wsl.exe --distribution rancher-desktop --exec /mnt/c/Users/user/AppData/Local/Programs/Rancher Desktop/resources/resources/linux/wsl-helper k3s kubeconfig

maybe this is also helpful, I found this right above the log that was cut short in the snippet above:

2022-08-08T07:57:54.148Z: Running: wsl.exe --distribution rancher-desktop --exec nerdctl images
2022-08-08T07:57:54.295Z: Command nerdctl,images failed:  Error: wsl.exe exited with code 1
    at ChildProcess.<anonymous> (C:\Users\user\AppData\Local\Programs\Rancher Desktop\resources\app.asar\dist\app\background.js:17:142946)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
  code: 1,
  command: [
    'wsl.exe',
    '--distribution',
    'rancher-desktop',
    '--exec',
    'nerdctl',
    'images'
  ]
}

Expected Behavior

Kubernetes starts.

Additional Information

Windows NO_PROXY environment variable: kubernetes.docker.internal,127.0.0.1,localhost,172.18.108.0/24,10.96.0.0/12,192.168.59.0/24,192.168.39.0/24,192.168.49.0/24,.*github.com,0.0.0.0,10.0.0.0/8,cattle-system.svc,.svc,.cluster.local

Rancher Desktop Version

Rancher Desktop 1.5.0 - win32 (x64)

Rancher Desktop K8s Version

1.24.3

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 10 21H2 (Build 19044.1826)

What CPU architecture are you using?

x64

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

No response

Windows User Only

VPN Cisco AnyConnect

brubrz commented 2 years ago

Looking through the settings I also see and Error in the WSL preferences, which may be unrelated: Error: File /home/user/.kube/config exists and is not a symlink

ghost commented 2 years ago

I use wsl-vpnkit to provide network connectivity to the WSL, this might help as well

mon-jai commented 2 years ago

Looking through the settings I also see and Error in the WSL preferences, which may be unrelated: Error: File /home/user/.kube/config exists and is not a symlink

That happens to me too.

gaktive commented 2 years ago

Potentially related to #905 -- checking.

mon-jai commented 2 years ago

Looking through the settings I also see and Error in the WSL preferences, which may be unrelated: Error: File /home/user/.kube/config exists and is not a symlink

That happens to me too.

In my case, I mounted %USERPROFILE% to ~ in WSL, like below

/home$ ls -la
lrwxrwxrwx  1 user user   12 Jun  9 21:27 user -> /c/Users/user

%USERPROFILE%/.kube/config exists on windows and conflicts with the /home/user/.kube/config file on WSL.

bitemarcz commented 2 years ago

A little bit confused @mon-jai ? How did you do this? Did you just mount %USERPROFILE% to ~? Not sure that really makes sense to me.

I'm also running into the same issue.

mon-jai commented 2 years ago

@maczamora Something like this.

WINDOWS_USER_PROFILE="$(wslpath "$(wslvar USERPROFILE)")"
HOME_DICECTORY="/home/$(whoami)"

# https://askubuntu.com/a/86891
cp -vra ~/. $WINDOWS_USER_PROFILE
sudo rm -r $HOME_DICECTORY
sudo ln -s $WINDOWS_USER_PROFILE $HOME_DICECTORY
sudo chown $(whoami):$(whoami) -R $HOME_DICECTORY

I did that so that I could access my files and projects with ~, e.g. ~/Documents.

benzman81 commented 1 year ago

Looking through the settings I also see and Error in the WSL preferences, which may be unrelated: Error: File /home/user/.kube/config exists and is not a symlink

That happens to me too.

Same happend to me. I just exited rancher desktop, then deleted /home/user/.kube/config in wsl and started rancher desktop again. Now kubectl was working again.