If you have a Windows system with WSL installed and have set up access to a public cloud for connecting to your clusters via
kubectl this means you probably have installed the necessary cloud cli tools (such as
gcloud) via WSL (on Ubuntu say). So from Ubuntu you can run
kubectl commands to access your clusters. You will also want to access your clusters using Lens, and you might be tempted to install and run the Windows version of Lens to do this. However, Lens relies on the same kubeconfig that
kubectl uses to access your clusters. This kubeconfig likely references some of the cloud tools that you installed on Ubuntu under WSL. The Windows version of Lens will not be able to access your clusters using the kubeconfig set up in WSL unless you do the same cloud setup in Windows that you did in WSL. But you probably did the cloud set up under WSL because you didn’t want to (or couldn’t) set it up under Windows. One solution is to install the linux version of Lens under WSL.
To activate Lens you will need to download an activation token, if your Lens account supports it, or activate via the browser. For the latter you must have a browser installed in your WSL2 setup. Note that if you use the port-forwarding feature in Lens you will also need a browser installed in WSL2. If you don’t already have one under WSL2 there are many options available. One way is to set up chrome on Ubuntu as described here. Once installed, run the browser and make it the default so that Lens will use it for activation and port-forwarding.
The next step is to install Lens. On WSL2 there are a few linux options. To benefit from auto-updates you can download the AppImage version of Lens. First, AppImages require FUSE version 2 to run, follow the instructions here.
Next, install the Lens AppImage according to these instructions (use the WSL2 installed browser to view the instructions and download the AppImage file). Use the
chmod instructions to make the file executable, ignore the file manager steps. To start Lens just type the path to the file. For example, in the directory where you downloaded it, enter:
The file name is different depending on what version you downloaded.
Alternatively, you can install the repository version of Lens. On Ubuntu first install some required dependencies:
sudo apt update sudo apt install -y libgbm-dev libasound2
Then follow the instructions here