kvm2

Linux KVM (Kernel-based Virtual Machine) driver

Overview

KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions. To work with KVM, minikube uses the libvirt virtualization API

Requirements

  • libvirt v1.3.1 or higher
  • qemu-kvm v2.0 or higher

Installing Prerequisites

Proper installation of KVM and libvirt is highly specific to each Linux distribution. Please consult:

Once configured, validate that libvirt reports no errors:

virt-host-validate

Usage

Start a cluster using the kvm2 driver:

minikube start --driver=kvm2

To make kvm2 the default driver:

minikube config set driver kvm2

Check virtualization support

To use VM drivers, verify that your system has virtualization support enabled:

egrep -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no

If the above command outputs “no”:

  • If you are running within a VM, your hypervisor does not allow nested virtualization. You will need to use the None (bare-metal) driver
  • If you are running on a physical machine, ensure that your BIOS has hardware virtualization enabled

Special features

The minikube start command supports 3 additional kvm specific flags:

  • --gpu: Enable experimental NVIDIA GPU support in minikube
  • --hidden: Hide the hypervisor signature from the guest in minikube
  • --kvm-network: The KVM network name
  • --kvm-qemu-uri: The KVM qemu uri, defaults to qemu:///system

Issues

  • minikube will repeatedly ask for the root password if user is not in the correct libvirt group #3467
  • Machine didn't return an IP after 120 seconds when firewall prevents VM network access #3566
  • unable to set user and group to '65534:992 when dynamic ownership = 1 in qemu.conf #4467
  • KVM VM’s cannot be used simultaneously with VirtualBox #4913
  • On some distributions, libvirt bridge networking may fail until the host reboots

Also see co/kvm2 open issues

Nested Virtulization

If you are running KVM in a nested virtualization environment ensure your config the kernel modules correctly follow either this or [this](VM follow to config the kernel modules. also https://computingforgeeks.com/how-to-install-kvm-virtualization-on-debian/) tutorial.

Troubleshooting

  • Run virt-host-validate and check for the suggestions.
  • Run minikube start --alsologtostderr -v=7 to debug crashes
  • Run docker-machine-driver-kvm2 version to verify the kvm2 driver executes properly.
  • Read How to debug Virtualization problems
Last modified July 7, 2020: Update kvm2.md (1de1195cf)