wiki.getshifting.com

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


wsl

Installing and configuring WSL for a DevOps Engineer

Summary: This wiki page shows how to install and configure WSL for use with all sort of DevOps tools like kubernetes, helm, Argo CD and more.
Date: 28 July 2025

WSL is the Windows Subsystem for Linux, which allows you to run a Linux distribution alongside your Windows installation. This is particularly useful for DevOps engineers who need to work with tools that are more commonly used in Linux environments.

Installing WSL

To install WSL, you can simply run the command wsl --install in a PowerShell or Command Prompt window with administrator privileges. This will install the default Linux distribution (usually Ubuntu) and set up WSL 2. This is the preferred version as it provides better performance and compatibility with Linux applications. See the official WSL installation guide for more details. The guide below assumes you're using Ubuntu as your WSL distribution. This is the default, but in case you've installed a different distribution, the command to install Ubuntu is: wsl --install -d Ubuntu. After the installation a prompt will tell you to setup a local user account.

Note: After installation of WSL a reboot might be required.

I also recommend to install the Windows Terminal from the Microsoft Store, which provides a better command line experience than the default console.

Configuring WSL for DevOps Tools

For all installations below, you can start WSL by opening the Windows Terminal and selecting the Ubuntu profile from the dropdown menu. This will open a new terminal window running your WSL distribution.

Docker Desktop

Docker Desktop is the best way to use the docker cli in WSL. Install Docker Desktop from the Docker website. After installation, you can start Docker Desktop and it will automatically configure WSL to use Docker.

Use the following commands to add your user to the docker group, so you can run docker commands without sudo:

sudo groupadd docker
sudo usermod -aG docker $USER

Be sure to start Docker Desktop before you start WSL if you plan to use Docker commands.

Azure CLI

Azure CLI is a cross-platform command-line tool for managing Azure resources with interactive commands or scripts. To install azure cli in WSL you can run the following command:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Verify the installation
az version

Kubectl

Note that kubectl can also be installed using the Azure CLI with az aks install-cli. The following instructions are for manual installation.

Kubectl is the command-line tool for interacting with Kubernetes clusters. To install kubectl in WSL, follow these steps:

  • Check the latest stable release and download the appropriate binary for your architecture.
# Download the latest stable release of kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# Install kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
# Verify the installation
kubectl version --client

Helm

Helm is a package manager for Kubernetes that allows you to easily install and manage applications on your Kubernetes cluster. To install Helm in WSL, follow these steps:

# Download the Helm installation script
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
# Make the script executable
chmod 700 get_helm.sh
# Run the script to install Helm
./get_helm.sh
# Verify the installation
helm version

You can also install the helm-git plugin by running the following command:

helm plugin install https://github.com/aslafy-z/helm-git --version 1.3.0

Helmfile

Helmfile is a tool that helps you manage multiple Helm charts and their configurations. To install Helmfile in WSL, follow these steps:

  • Check the latest stable release and download the appropriate tarball for your architecture. For example, for version 0.168.0, you can use:
# Download the latest stable release of Helmfile
wget https://github.com/helmfile/helmfile/releases/download/v0.168.0/helmfile_0.168.0_linux_amd64.tar.gz
# Extract the tarball
tar -xf helmfile_0.168.0_linux_amd64.tar.gz
# Move the helmfile binary to /usr/local/bin
sudo mv helmfile /usr/local/bin/
# Verify the installation
helmfile version

Argo CD

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. To install Argo CD in WSL, follow these steps:

Install latest version:

# Download the latest version of Argo CD CLI
sudo curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
# Make the binary executable
sudo chmod +x /usr/local/bin/argocd
# Verify the installation
argocd version

Install specific version:

# Download a specific version of Argo CD CLI
VERSION=v2.14.11
sudo curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
# Make the binary executable
sudo chmod +x /usr/local/bin/argocd
# Verify the installation
argocd version

Kustomize

Kustomize is a tool for customizing Kubernetes YAML configurations. To install Kustomize in WSL, follow these steps:

# Download the Kustomize installation script
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
# Move the kustomize binary to /usr/local/bin
sudo mv kustomize /usr/local/bin
# Verify the installation
kustomize version

Kubelogin

Note that kubelogin can also be installed using the Azure CLI with az aks install-cli. The following instructions are for manual installation.

Kubelogin is a tool that allows you to authenticate to Kubernetes clusters using Azure Active Directory. To install Kubelogin in WSL, follow these steps:

# Download the latest version of Kubelogin
curl -L --insecure -o kubelogin-linux-amd64.zip <https://github.com/Azure/kubelogin/releases/download/v0.1.6/kubelogin-linux-amd64.zip>
# Unzip the downloaded file
sudo apt-get install unzip
unzip -o kubelogin-linux-amd64.zip -d kubelogin
# Move the kubelogin binary to /usr/local/bin
sudo cp kubelogin/bin/linux_amd64/kubelogin /usr/local/bin/
# Configure kubelogin to use Azure CLI for authentication
kubelogin convert-kubeconfig -l azurecli

YQ

YQ is a command-line YAML processor that is useful for working with Kubernetes manifests and other YAML files. To install YQ in WSL, follow these steps:

# Download the latest version of YQ
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
# Make the binary executable
chmod +x yq_linux_amd64
# Move the yq binary to /usr/local/bin
sudo mv yq_linux_amd64 /usr/local/bin/yq
# Verify the installation
yq --version

Troubleshooting

If you encounter issues with kubectl not being able to connect to the Kubernetes API server, you may need to set the KUBECONFIG environment variable to point to your kubeconfig file. This is often located at `~/.kube/config` or in a custom location.

echo 'export KUBECONFIG=/mnt/c/Users/sjoerd/.kube/config' >> ~/.bashrc
source ~/.bashrc
wsl.txt · Last modified: by sjoerd