Easy install using Cloud Providers


KubeVirt has been tested on GCP and AWS providers, this approach is intended for demonstration purposes similar to the environments for Kind and Minikube and of course the Katacoda scenarios.

KubeVirt can be tested on external Cloud Providers like AWS, Azure, GCP, AliCloud, and others.

Note this setup is not meant for production, it is meant to give you a quick taste of KubeVirt’s functionality.

Step1: Create a new K8S cluster

Usage of Cloud Providers like GCP or AWS (or others) might have additional costs or require trial account and setup prior to be able to run those instructions, like for example, creating a default keypair or others.

Check Kubernetes.io guide for each cloud provider to match your use case:

Provider Link
Others https://kubernetes.io/docs/setup/production-environment/turnkey/
AliCloud https://kubernetes.io/docs/setup/production-environment/turnkey/alibaba-cloud/
AWS https://kubernetes.io/docs/setup/production-environment/turnkey/aws/
Azure https://kubernetes.io/docs/setup/production-environment/turnkey/azure/
GCP https://kubernetes.io/docs/setup/production-environment/turnkey/gce/

Create a disk of 30Gb at least.

After following the instructions provided by Kubernetes.io, kubectl can be used to manage the cluster.

Deploy KubeVirt Operator

Having the cluster up and running, let’s set the version environment variable that will be used on few commands:

# On other OS you might need to define it like
export KUBEVIRT_VERSION="v0.18.0"

# On Linux you can obtain it using 'curl' via:
export KUBEVIRT_VERSION=$(curl -s https://api.github.com/repos/kubevirt/kubevirt/releases | grep tag_name | grep -v -- - | sort -V | tail -1 | awk -F':' '{print $2}' | sed 's/,//' | xargs)


Now, using the kubectl tool, let’s deploy the KubeVirt Operator:

kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/kubevirt-operator.yaml

Check it’s running:

kubectl get pods -n kubevirt
NAME                             READY     STATUS              RESTARTS   AGE
virt-operator-6c5db798d4-9qg56   0/1       ContainerCreating   0          12s
virt-operator-6c5db798d4-9qg56   1/1       Running   0         28s

We’ll need to execute the command above few times (or add -w for watching the pods), until the operator is Running and Ready (1/1), then it’s time to head to the next section.

Check for the Virtualization Extensions

To check if your VM’s CPU supports virtualization extensions execute the following command:

egrep 'svm|vmx' /proc/cpuinfo

If the command doesn’t generate any output, create the following ConfigMap so that KubeVirt uses emulation mode, otherwise skip to the next section:

kubectl create configmap kubevirt-config -n kubevirt --from-literal debug.useEmulation=true

Deploy KubeVirt

KubeVirt is then deployed by creating a dedicated custom resource:

kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/kubevirt-cr.yaml

Check the deployment:

kubectl get pods -n kubevirt
NAME                               READY     STATUS    RESTARTS   AGE
virt-api-649859444c-fmrb7          1/1       Running   0          2m12s
virt-api-649859444c-qrtb6          1/1       Running   0          2m12s
virt-controller-7f49b8f77c-kpfxw   1/1       Running   0          2m12s
virt-controller-7f49b8f77c-m2h7d   1/1       Running   0          2m12s
virt-handler-t4fgb                 1/1       Running   0          2m12s
virt-operator-6c5db798d4-9qg56     1/1       Running   0          6m41s

Once we applied the Custom Resource the operator took care of deploying the actual KubeVirt pods (virt-api, virt-controller and virt-handler). Again we’ll need to execute the command until everything is up&running (or use -w).

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

If krew plugin manager is installed, virtctl can be installed via krew:

$ kubectl krew install virt

Then virtctl can be used as a kubectl plugin. For a list of available commands run:

$ kubectl virt help

Once krew plugin is installed, every occurrence throughout this guide of

$ ./virtctl <command>...

should then be read as

$ kubectl virt <command>...

Step 2: KubeVirt labs

After you have connected to your instance through SSH, you can work through a couple of labs to help you get acquainted with KubeVirt and how to use it to create and deploy VMs with Kubernetes.

The first lab is “Use KubeVirt”. This lab walks through the creation of a Virtual Machine Instance (VMI) on Kubernetes and then it is shown how virtctl is used to interact with its console.

The second lab is “Experiment with CDI”. This lab shows how to use the Containerized Data Importer (CDI) to import a VM image into a Persistent Volume Claim (PVC) and then how to define a VM to make use of the PVC.

The third lab is “KubeVirt upgrades”. This lab shows how easy and safe is to upgrade your KubeVirt installation with zero down-time.

Found a bug?

We are interested in hearing about your experience.

If experience a problem with the labs, please report it to the kubevirt.io issue tracker.