rancher-desktop icon indicating copy to clipboard operation
rancher-desktop copied to clipboard

WSL integration does't install if symlink to windows .kube dir

Open eirisdg opened this issue 2 years ago • 1 comments

Rancher Desktop Version

1.0.0-beta1

Rancher Desktop K8s Version

1.23.1

What operating system are you using?

Windows

Operating System / Build Version

Windows 10 Enterprise / 21H1 19043.1110

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

Actual Behavior

I've 2 WSL installations. In all of them, I have a symlink from /home/user/.kube folder pointing to the original /mnt/c/users/user/.kube folder. So, in this way, if I need any k8s configuration, I dont need to replicate in Windows and WSL.

Ok, but then, when I try to install Rancher Desktop, I've an issue when try to instal WSL integration. It doesn't install WSL integration if there is another config file in .kube... but this config file is the one created in the Windows .kube folder.

I think that an expected situation should be to recognize if .kube folder is a symlink, and not only the config file in it.

Steps to Reproduce

Create a symlink to .kube folder from wsl to windows.

Result

WSL integration doesn't install with symlink to folder

Expected Behavior

I think that an expected situation should be to recognize if .kube folder is a symlink, and not only the config file in it.

Additional Information

No response

eirisdg avatar Jan 20 '22 19:01 eirisdg

This is related to #1312.

adamkpickering avatar Aug 16 '22 22:08 adamkpickering

After working on this for a day, I'm not sure we can do this with our current design.

The problem is that we use the existence of ~/.kube/config as an indicator to show whether the distro is "integrated" with Rancher Desktop or not.

If you symlink ~/.kube to /mnt/c/Users/USER/.kube instead of symlinking ~/.kube/config to /mnt/c/Users/USER/.kube/config, it looks to our code like the distro is always integrated.

And deleting the ~/.kube symlink defeats the purpose of having created it in the first place.

Looking at #1312, it looks like we need a different indicator of an integration. Will look at the code to see if this is plausible...

ericpromislow avatar Jan 06 '23 22:01 ericpromislow

Thanks for looking into this. I am using WSL2 for some years, managing multiple bare-metal and EKS clusters with kubectl etc. I wanted to give RD a try and stumbled on this issue.

IMHO, the existence of ~/.kube or ~/.kube/config should not be used to deduce any information about a RD integration, because it is a valid usecase to have these files. I think you need to look at WSL2 the same way you treat a native Linux environment. The main reason to use the Windows version of RD is to leverage Windows native window controls etc.

Eventually it failed anyways and killed my WSL2 instance 🤦 I will just use the Linux version of RD from within WSL2, works just fine :-) (the GUI, did not get a positive response from "Starting virtual machine")

2023-03-11T16:09:20.714Z: Registered distributions: Ubuntu-18.04,docker-desktop,docker-desktop-data,Ubuntu-20.04,Alpine,rancher-desktop
2023-03-11T16:09:20.903Z: Registered distributions: Ubuntu-18.04,docker-desktop,docker-desktop-data,Ubuntu-20.04,Alpine,rancher-desktop
2023-03-11T16:09:20.904Z: Creating initial data distribution...
2023-03-11T16:09:26.785Z: Did not find a valid mount, mounting /mnt/wsl/rancher-desktop/run/data
2023-03-11T16:09:30.527Z: Installing C:\Program Files\Rancher Desktop\resources\resources\linux\internal\trivy as /mnt/c/Program Files/Rancher Desktop/resources/resources/linux/internal/trivy into /usr/local/bin/trivy ...
2023-03-11T16:09:33.289Z: WSL: executing: cat /root/.docker/config.json: Error: wsl.exe exited with code 1
2023-03-11T16:09:34.518Z: Installing C:\Program Files\Rancher Desktop\resources\resources\linux\internal\rancher-desktop-guestagent as /mnt/c/Program Files/Rancher Desktop/resources/resources/linux/internal/rancher-desktop-guestagent into /usr/local/bin//rancher-desktop-guestagent ...
2023-03-11T16:12:18.326Z: /sbin/init exited with status 1 signal null
2023-03-11T16:12:48.329Z: WSL: executing: /bin/sh -c if test -r /etc/rancher/k3s/k3s.yaml; then echo yes; else echo no; fi: Error: wsl.exe exited with code 4294967295

blackliner avatar Mar 11 '23 16:03 blackliner

Still an issue! I saw it was prioritized as 'Later', I would like to see some more urgent prioritization.. Currently it makes it hard to use Rancher Desktop as a good alternative to Docker Desktop.

ThijsFTW avatar May 15 '23 15:05 ThijsFTW