Skip to content
Easy to use KubeVirt demo based on minikube.
Branch: master
Clone or download
fabiand Merge pull request #115 from dhiller/master
Add virtctl krew install and remarks regarding usage of virtctl with …
Latest commit 737f54d Jun 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
ci @ 7d35719 ci: Update to a recent snapshot May 7, 2019
manifests Some follow up fixes Mar 18, 2019
.gitignore Restructure CI Sep 6, 2018
.gitmodules Import ci module Sep 6, 2018
.travis.yml ci: Drop IRC notifications May 7, 2019 Update README for v0.18.1 Jun 14, 2019 test: Increase timeouts May 8, 2019

Build Status

KubeVirt Demo

This demo will guide you through setting up KubeVirt on


Deploy KubeVirt

This demo assumes that minikube or minishift is configured and running as described below and that kubectl available on your system. If not, then please take a look at the guide below.

The first step is to start minikube:

$ minikube config set vm-driver kvm2
$ minikube start --memory 4096
😄  minikube v1.0.1 on linux (amd64)
💿  Downloading Minikube ISO ...
 142.88 MB / 142.88 MB [============================================] 100.00% 0s
🤹  Downloading Kubernetes v1.14.1 images in the background ...
🔥  Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
📶  "minikube" IP address is
🐳  Configuring Docker as the container runtime ...
🐳  Version of container runtime is 18.06.3-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
💾  Downloading kubelet v1.14.1
💾  Downloading kubeadm v1.14.1
🚜  Pulling images required by Kubernetes v1.14.1 ...
🚀  Launching Kubernetes v1.14.1 using kubeadm ...
⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑  Configuring cluster permissions ...
🤔  Verifying component health .....
💗  kubectl is now configured to use "minikube"
🏄  Done! Thank you for using minikube!

Before we can deploy KubeVirt we create a small config, to adjust KubeVirt to your environment. Specifically enabling software emulation for your VMs in case that no hardware virtualization support is present.

$ kubectl create namespace kubevirt

# Either nesting as described [below](#setting-up-minikube) will be used, or we configure emulation if
# no nesting is available:
$ minikube ssh -- test -e /dev/kvm \
  || kubectl create configmap -n kubevirt kubevirt-config --from-literal debug.useEmulation=true

Now you are finally ready to deploy KubeVirt using our operator (comparable to an installer):

$ kubectl apply -f
deployment.apps/virt-operator created

$ kubectl apply -f created

The initial deployment can take a long time, because a number of pods have to be pulled from the internet. We'll watch the operator status to determine when the deployment is completed:

$ kubectl wait --timeout=180s --for=condition=Ready -n kubevirt kv/kubevirt condition met

Congratulations, KubeVirt was successfully deployed.

Install virtctl

An additional binary is provided to get quick access to the serial and graphical ports of a VM, and handle start/stop operations. The tool is called virtctl and can be retrieved from the release page of KubeVirt:

$ curl -L -o virtctl
$ chmod +x virtctl

Installing with krew

If you installed krew, you can install virtctl as a kubectl plugin:

$ kubectl krew install virt

Starting and stopping a VirtualMachine

Once you deployed KubeVirt you are ready to launch a VM:

if virtctl is installed via krew, please use kubectl virt ... instead of ./virtctl ...

# Creating a virtual machine
$ kubectl apply -f

# After deployment you can manage VMs using the usual verbs:
$ kubectl describe vm testvm

# To start a VM you can use, this will create a VM instance (VMI)
$ ./virtctl start testvm

# The interested reader can now optionally inspect the instance
$ kubectl describe vmi testvm

# To shut the VM down again:
$ ./virtctl stop testvm

# To delete
$ kubectl delete vm testvm
# To create your own
$ kubectl apply -f $YOUR_VM_SPEC

Accessing VMs (serial console & VNC)

if virtctl is installed via krew, please use kubectl virt ... instead of ./virtctl ...

# Connect to the serial console
$ ./virtctl console testvm

# Connect to the graphical display
# This requires remote-viewer from the virt-viewer package and a graphical desktop from where oyu run virtctl
$ ./virtctl vnc testvm

Next steps

User Guide

Now that KubeVirt is up an running, you can take a look at the user guide to understand how you can create and manage your own virtual machines.


Setting up Minikube

  1. (Optional) Minikube has support for nested virtualization, it can be enabled as described here.

  2. If not installed, install minikube as described here:

    1. Install the kvm2 driver
    2. Download the minikube binary
  3. Launch minikube with the desired memory

$ minikube start --vm-driver kvm2 --feature-gates=DevicePlugins=true --memory 4096
  1. Install kubectl via a package manager or download it

Running on OKD or minishift

OKD is just another Kubernetes distribution, and you can also use kubectl to interact with such a cluster. However, the oc tool is part of OKD and provides additional commands for managing your cluster.

  1. Get the oc tool

  2. Download the openshift-client-tools tarball from here:

  3. Extract the oc tool from the API tool tar xf openshift-origin-client-tools*.tar.gz

  4. Launch oc cluster:

oc cluster up --skip-registry-check --enable=router,sample-templates
You can’t perform that action at this time.