Last active
March 30, 2023 22:58
-
-
Save jnaous/ed49823fe71aa64ca6b326b21ec83e0f to your computer and use it in GitHub Desktop.
Getting minikube to run with --driver=kvm2 on WSL2 on Windows 11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add the following to your /etc/wsl.conf file | |
[boot] | |
command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm' | |
command = /bin/bash -c 'service dbus start' | |
command = /bin/bash -c 'service docker start' | |
command = /bin/bash -c 'libvirtd -d' | |
command = /bin/bash -c 'virtlogd -d' | |
[wsl2] | |
nestedVirtualization=true | |
# After your done with this, restart wsl. From a cmd prompt: wsl.exe --shutdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Now here's all the steps to install docker, minikube, kubectl, helm, and run minikube with kvm2 for nested virtualization. | |
# First, install docker | |
sudo apt-get remove docker docker-engine docker.io containerd runc | |
sudo apt-get update | |
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install docker-ce docker-ce-cli containerd.io -y | |
# Allow docker use without root | |
sudo groupadd docker | |
sudo usermod -aG docker ${USER} | |
# Install minikube | |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb | |
sudo apt install ./minikube_latest_amd64.deb -y | |
rm minikube_latest_amd64.deb | |
# Install kubectl | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list | |
sudo apt-get update | |
sudo apt install kubectl -y | |
# Install helm | |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list | |
sudo apt-get update | |
sudo apt-get install helm | |
# Install libvirt and make it work | |
sudo apt install libvirt0 libvirt-daemon libvirt-daemon-system libvirt-daemon-driver-qemu dnsmasq | |
sudo groupadd libvirt | |
sudo chown root:kvm /dev/kvm | |
sudo chmod 660 /dev/kvm | |
sudo usermod --append --groups kvm,libvirt "${USER}" | |
sudo mkdir -p /var/log/libvirt | |
# Start services | |
sudo service dbus start | |
sudo service docker start | |
sudo libvirtd -d | |
sudo virtlogd -d | |
# Finally start minikube with kvm2 | |
minikube start --driver=kvm2 --cni=flannel -p=my-new-cluster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment