Verify kvm2 support
Confirm virtualization support by CPU
egrep -c ‘(svm|vmx)’ /proc/cpuinfo
An output of 1 or more indicate that CPU can use virtualization technology.
sudo kvm-ok
Output “KVM acceleration can be used. ” indicate that the system has virtualization enabled and KVM can be used.
Install kvm packages
sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
Start libvirtd service
sudo service libvirtd start
Add your user to libvirt and kvm group
sudo adduser `id -un` libvirt sudo adduser `id -un` kvm
and re-login the user
sudo login -f `id -un`
Verify installation
virsh list --all #and virt-host-validate
If above show no FAIL statuses and no errors when kvm part is done.
In case of: ” libvir: Remote error : Permission denied ” verify which group libvirtd is using
grep "unix_sock_group" /etc/libvirt/libvirtd.conf
Check /dev/kvm is in ‘kvm’ group
ls -l /dev/kvm crw-rw---- 1 root kvm 10, 232 Dec 10 11:15 /dev/kvm
Check /var/run/libvirt/libvirt-sock is in ‘libvirt’ group
ls -l /var/run/libvirt/libvirt-socks rwxrwx--- 1 root libvirt 0 Dec 10 10:45 /var/run/libvirt/libvirt-sock
In case groups are different update the group:
sudo chown root:kvm /dev/kvm
Now you need to either re-login or restart the kernel modules:
rmmod kvm
modprobe -a kvm
Docker machine kvm2 driver
docker-machine-driver-kvm2 driver
To support kvm2 driver minikube required docker-machine-driver-kvm2 to be installed in system $PATH. Latest minikube version will download that driver in bootstrap process. Upgrading to latest minikube will help with that step.
Update minikube settings to use kvm2 driver
minikube config set vm-driver kvm2
If you don’t want to set kvm2 as default driver you can use --vm-driver kvm2
option in minikube start command.
Start minikube with kvm2
minikube start --memory=16384 --cpus=4 -p minikube-kvm2 --vm-driver kvm2
Expected output:
Downloading driver docker-machine-driver-kvm2 minikube v1.5.2 on Ubuntu 18.04 Creating kvm2 VM (CPUs=4, Memory=6688MB, Disk=20000MB) ... Preparing Kubernetes v1.16.2 on Docker '18.09.9' ...