Introduction to OpenShift Virtulization

Introduction to OpenShift Virtulization

Kubevirt Header Image

Recently I published the video below showing a very quick introduction to running virtual machines on OpenShift with KubeVirt. One of the comments in response was a request to get a write up on deploying the KubeVirt UI shown in the video. I decided instead to post all of my steps for configuring KubeVirt and the UI on top of my existing OpenShift cluster. Note that my cluster had bare metal app nodes.


Prior to configuring Kubevirt, you need a Kubernetes, OKD, or Openshift Container Platform cluster deployed. Those deployment instructions are well covered outside of this article. For the video, I am using an OKD 3.11 cluster with 1 master node, 1 infra node (both in VMs) and 8 bare metal app nodes.

If your app nodes are virtual machines, you will either need nested virt enabled on your hypervisors, or you can try software emulation.

Access to a machine that has the oc client installed and logged in with cluster-admin privs.

Configuring KubeVirt

Keep in mind that these are the steps I took on the cluster shown in the video. If you have suggestions for improvement, reach out.

First we set a few policies on our OpenShift cluster.

$ oc adm policy add-scc-to-user privileged -n kube-system -z kubevirt-privileged
$ oc adm policy add-scc-to-user privileged -n kube-system -z kubevirt-controller
$ oc adm policy add-scc-to-user privileged -n kube-system -z kubevirt-apiserver

Next, we apply the template for KubeVirt.

$ RELEASE=v0.11.0
$ oc apply -f${RELEASE}/kubevirt.yaml

Now let’s add the KubeVirt UI.

$ oc new-project kubevirt-web-ui
$ oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:kubevirt-web-ui:default
$ oc apply -f

The KubeVirt CLI is currently still stand alone. So we need to download it and make it executable. You could also add it to your path.

$ curl -L -o virtctl$RELEASE/virtctl-$RELEASE-linux-amd64
$ chmod +x virtctl

Last of all, let’s test a Virtual Machine! This template uses a small test linux image named Cirros.

$ oc create -f
$ ./virtctl start testvm


  1. OpenShift Documentation
  2. KubeVirt Docs
  3. Free OpenShift Labs