QuickStart: Installing KubeVirt In Under 5 Minutes

Michael Levan - Sep 16 - - Dev Community

In this quickstart, you’ll learn how to get KubeVirt installed and what system requirements you need to run KubeVirt.

What’s KubeVirt?

Virtual Machines (VM) are not dead. If you don’t believe me, check out the millions and millions of dollars that organizations pay data centers or the millions of dollars they spend to host their own data centers.

The biggest question now is “Where do I host VMs?”.

With the VMWare acquisition and organizations looking to move off of ESXi, a lot of engineers and leaders are looking at Kubernetes to solve the problem. The new “problem” then becomes “I don’t want to run my applications in containers”.

KubeVirt solves that.

It’s a method of running actual VM’s (not containers) on Kubernetes.

Necessary System Resources

The least amount of resources you’ll want are:

  • 2 CPUs
  • 4GB of RAM
  • 30GB of storage.

If you want a highly performance infrastructure, you’ll want a Kubernetes cluster that’s running at least double that.

Installation

With any installation option, you’ll be installing:

  1. The KubeVirt Custom Resources.
  2. The KubeVirt Operator.

The first option is with a specific version. Notice how in the examples below, it’s Kubevirt v1.2.1.

kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v1.2.1/kubevirt-operator.yaml
Enter fullscreen mode Exit fullscreen mode
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v1.2.1/kubevirt-cr.yaml
Enter fullscreen mode Exit fullscreen mode

The second option is by calling upon the latest release for KubeVirt.

export VERSION=$(curl -s https://api.github.com/repos/kubevirt/kubevirt/releases | grep tag_name | grep -v -- '-rc' | sort -r | head -1 | awk -F': ' '{print $2}' | sed 's/,//' | xargs)

Enter fullscreen mode Exit fullscreen mode
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/$VERSION/kubevirt-operator.yaml
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/$VERSION/kubevirt-cr.yaml
Enter fullscreen mode Exit fullscreen mode

Once complete, you should be able to run the following and see KubVirt running.

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

Cleanup

If you want to delete KubeVirt and all of it’s CRD’s, run the following:

kubectl delete -f https://github.com/kubevirt/kubevirt/releases/download/v1.2.0/kubevirt-operator.yaml
kubectl delete -f https://github.com/kubevirt/kubevirt/releases/download/v1.2.0/kubevirt-cr.yaml
Enter fullscreen mode Exit fullscreen mode
MATCH_STRING="kubevirt"
kubectl get crds -oname | grep "$MATCH_STRING" | xargs kubectl delete
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .