Setup Minikube on WSL2 for Windows 10

Working as of 04/23/2021

After following a few guides (linked below) I wasn’t able to get Minikube running under WSL2. So this guide serves as a quick TL:DR that worked for me and was repeatable.

I will say that I have given my user password-less sudo access, which you can read about in my guide to setting up WSL for development.

Install WSL2 systemd & prerequisites

From the script by DamionGans

Make sure you have git installed.

sudo apt install git

Then clone the helper script which automates systemd setup in WSL containers.

git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
# Enter your password and wait until the script has finished

Close the terminal and reopen a new one and verify its working.

systemctl

If you see a list of units, the script worked.

Install Minikube

Minikube requires conntrack packages to work properly, so install that prior to moving on.

sudo apt install -y conntrack

Finally install minikube itself, and move it to the bin folder so its globally available when you restart the bash.

# Download the latest version of Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
# Make the binary executable
chmod +x ./minikube
# Move the binary to your executable path
sudo mv ./minikube /usr/local/bin/
minikube config set driver docker

Attach or Reattach Docker Desktop WSL Integration

Finally start minikube and run the dashboard

minikube start
minikube status
minikube dashboard

And now when you visit the link provided you should see a functional Kubernetes dashboard: http://127.0.0.1:40143/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/overview?namespace=default

Guides with more details on each of these steps:

I am a founder & CEO of Code Atlantic and I've been working with WordPress for over 15 years creating plugins to help WP site owners grow for more than 10 of those. We have developed and maintained popular plugins including the best wordpress popup plugin, Popup Maker with over 4k 5 star reviews, as well as Content Control, Ahoy & User Menus.

Follow on:

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.