Install minikube with WSL2 on Windows
Install minikube with WSL2 on Windows
Minikube is a tool that runs a local Kubernetes cluster on your development machine. This guide sets it up on WSL2.
Windows Preparation
Enable WSL and Virtual Machine Platform (run PowerShell as Administrator):
1
2
3
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
bcdedit /set hypervisorlaunchtype auto
Set WSL default version to 2:
1
wsl --set-default-version 2
Configure WSL resource limits by editing $env:USERPROFILE\.wslconfig:
1
2
3
4
[wsl2]
memory=4GB
processors=2
swap=2GB
Install Ubuntu:
1
wsl --install Ubuntu-24.04
Note: Ensure hypervisor functionality is enabled in your BIOS before proceeding.
Install Docker Engine (inside WSL2)
Set up Docker’s apt repository:
1
2
3
4
5
6
7
8
9
10
sudo apt update
sudo apt install -y ca-certificates curl gpg
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker:
1
2
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Configure Docker to run without root privileges:
1
2
3
4
sudo groupadd docker
sudo usermod -aG docker ${USER}
su - ${USER}
sudo service docker start
Install minikube
1
2
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
Configure the Cluster
Use Docker as the driver and allocate all available resources:
1
2
3
minikube config set driver docker
minikube config set cpus max
minikube config set memory max
Verify configuration:
1
2
3
minikube config get driver
minikube config get cpus
minikube config get memory
Start minikube:
1
minikube start
Have fun with minikube!
This post is licensed under CC BY 4.0 by the author.