Running FreeLensin Windows sub-system for Linux (WSL)
I want to access a Gardener cluster with FreeLens.
Unfortunately tooling is very limited in Windows.
That's why my only reasonable approach for now is to use FreeLens in WSL.
This is a step-by-step guide.
Install and setup WSL
wsl --version
wsl --set-default-version 2
wsl --install -d ubuntu
wsl --set-default ubuntu
wsl --status
Check whether WSL starts, feel free to explore:
Provision config files
-
Create or copy the cluster > Access > "Kubeconfig - Gardenlogin" manifest
It contains /contexts/*, /cluster/* and /users/*.
-
Create or copy the My Account > Access > "Kubeconfig" manifest
~/.kube/garden-kubeconfig.yaml
It contains /contexts/*, /cluster/* and /users/*[name='oidc-login'].
-
Create or copy the cluster > Access > configuration for gardenlogin manifest
~/.garden/gardenctl-v2.yaml
It contains /gardens/identity and /gardens/kubeconfig.
Ensure the /gardens/kubeconfig points to your ~/.kube/garden-kubeconfig.yaml file.
Install and setup FreeLens in WSL
-
Update system
sudo apt update
sudo apt upgrade -y
-
Install required base packages
sudo apt install -y curl wget unzip jq xdg-utils
sudo apt install -y libasound2t64 libasound2-plugins alsa-utils
-
Link Windows Chrome into WSL
sudo ln -s "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" /usr/local/bin/chrome
export BROWSER=/usr/local/bin/chrome
echo 'export BROWSER=/usr/local/bin/chrome' >> ~/.bashrc
-
Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client
-
Install gardenlogin (required for Gardener clusters)
version=$(curl -s https://raw.githubusercontent.com/gardener/gardenlogin/master/LATEST)
curl -LO "https://github.com/gardener/gardenlogin/releases/download/${version}/gardenlogin_linux_amd64"
chmod +x gardenlogin_linux_amd64
sudo mv gardenlogin_linux_amd64 /usr/local/bin/gardenlogin
sudo ln -s /usr/local/bin/gardenlogin /usr/local/bin/kubectl-gardenlogin
gardenlogin version
-
Install kubelogin (OIDC plugin)
VERSION=$(curl -s https://api.github.com/repos/int128/kubelogin/releases/latest | grep tag_name | cut -d '"' -f4)
curl -LO https://github.com/int128/kubelogin/releases/download/${VERSION}/kubelogin_linux_amd64.zip
unzip kubelogin_linux_amd64.zip
chmod +x kubelogin
sudo mv kubelogin /usr/local/bin/
sudo ln -s /usr/local/bin/kubelogin /usr/local/bin/kubectl-oidc_login
kubelogin --version
-
Install Freelens
wget https://github.com/freelensapp/freelens/releases/latest/download/Freelens-linux-amd64.deb
sudo dpkg -i Freelens-linux-amd64.deb
sudo apt-get install -f -y
-
Start Freelens with your Gardener kubeconfig
KUBECONFIG=~/.kube/my-config.yaml freelens
Setup shortcut
-
Create a .bat file and save it somewhere.
@echo off
wsl bash -c "KUBECONFIG=~/.kube/my-config.yaml /usr/bin/freelens --no-sandbox"
You can now start FreeLens without command line.
-
(Optional) Create a pinned shortcut in taskbar
- Create a shortcut for the
.bat file.
- Edit the properties of he shortcut to target:
- C:\Users\xyz\foo\freelens.bat
+ C:\Windows\System32\cmd.exe /c "C:\Users\xyz\foo\freelens.bat"
- Drag and drop the shortcut to your taskbar.
Running FreeLensin Windows sub-system for Linux (WSL)
I want to access a Gardener cluster with FreeLens.
Unfortunately tooling is very limited in Windows.
That's why my only reasonable approach for now is to use FreeLens in WSL.
This is a step-by-step guide.
Install and setup WSL
Check whether WSL starts, feel free to explore:
Provision config files
Create or copy the cluster > Access > "Kubeconfig - Gardenlogin" manifest
It contains
/contexts/*,/cluster/*and/users/*.Create or copy the My Account > Access > "Kubeconfig" manifest
It contains
/contexts/*,/cluster/*and/users/*[name='oidc-login'].Create or copy the cluster > Access > configuration for gardenlogin manifest
It contains
/gardens/identityand/gardens/kubeconfig.Ensure the
/gardens/kubeconfigpoints to your~/.kube/garden-kubeconfig.yamlfile.Install and setup FreeLens in WSL
Update system
Install required base packages
Link Windows Chrome into WSL
Install kubectl
Install gardenlogin (required for Gardener clusters)
Install kubelogin (OIDC plugin)
Install Freelens
Start Freelens with your Gardener kubeconfig
Setup shortcut
Create a
.batfile and save it somewhere.You can now start FreeLens without command line.
(Optional) Create a pinned shortcut in taskbar
.batfile.