Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
k3s on WSL2

Instructions to hack up WSL2 on Windows 10 Build 18917 to run k3s (Kubernetes) and rio

Install WSL2

I already had Ubuntu-18.04 installed in wsl 1. So I just did wsl --set-version Ubuntu-18.04 2

Compile Kernel

Using Ubuntu 18.04 (I'm sure any distro will work), inside WSL2 download and extract to a folder. The latest version of the kernel source is available at (

In the extracted kernel source run

# Install basically "compile kernel" crap
sudo apt install build-essential flex bison libssl-dev libelf-dev

# Setup kernel config
cp Microsoft/config-wsl .config
cat >> .config << EOF
make oldconfig

# Compile and drink beverage of choice
make -j $(nproc)

Update WSL kernel

  1. Copy arch/x86/boot/bzImage to somewhere outside WSL2 (/mnt/c/Users/${USER}/Desktop)
  2. Shutdown WSL2 wsl --shutdown
  3. Copy bzImage to c:\Windows\System32\lxss\tools\kernel. Make sure you backup the existing kernel file (although the original is still in another location). I had to copy through explorer.exe because of permissions issues.

Install K3s

You can't install k3s using the curl script because there is no supervisor (systemd or openrc) in WSL2.

  1. Download k3s binary from
  2. chmod +x k3s
  3. Run k3s sudo ./k3s server

Setup access

  1. Copy /etc/rancher/k3s/k3s.yaml from WSL to your home in Windows to %HOME%.kube\config. Edit the copied file and change the server URL from https://localhost:6443 to the IP of the your WSL2 instance (ip addr show dev eth0). So something like
  2. Run kubectl from windows (got to download kubectl.exe from somewhere)

Bonus Install Rio

  1. Download rio-windows-amd64 from to rio.exe
  2. Run ./rio install
  3. Start doing stuff with rio :)

This comment has been minimized.

Copy link

justicel commented Jul 12, 2019

As of the latest release of the kernel code the .config modifications are no longer necessary! microsoft/WSL2-Linux-Kernel@a9f6b6e


This comment has been minimized.

Copy link

JuryA commented Sep 21, 2019

Awesome! ☸️😲👍


This comment has been minimized.

Copy link

mkostersitz commented Oct 17, 2019

Awesome. Just got it to work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.