This demo will deploy KubeVirt on an existing minikube with Kubernetes 1.9 or later.
This demo assumes that minikube is up and running and kubectl
available on your system. If not, then please take a look at the guide below
With minikube running, you can easily deploy KubeVirt:
$ export VERSION=v0.3.0
$ kubectl create \
-f https://github.com/kubevirt/kubevirt/releases/download/$VERSION/kubevirt.yaml
Note: The initial deployment to a new minikube instance can take a long time, because a number of containers have to be pulled from the internet. Use
watch kubectl get --all-namespaces pods
to monitor the progress.
Once you deployed KubeVirt you are ready to launch a VM:
# Creating a virtual machine
$ kubectl apply -f https://raw.githubusercontent.com/kubevirt/demo/master/manifests/vm.yaml
# After deployment you can manage VMs using the usual verbs:
$ kubectl get ovms
$ kubectl get ovms -o yaml testvm
# To start an offline VM you can use
$ kubectl patch offlinevirtualmachine testvm --type merge -p '{"spec":{"running":true}}'
$ kubectl get vms
$ kubectl get vms -o yaml testvm
# To shut it down again
$ kubectl patch offlinevirtualmachine testvm --type merge -p '{"spec":{"running":false}}'
# To delete: kubectl delete vms testvm
# To create your own: kubectl create -f $YOUR_VM_SPEC
Note: This requires
kubectl
from Kubernetes 1.9 or later on the client
A separate binary is provided to get quick access to the serial and graphical
ports of a VM. The tool is called virtctl
and can be retrieved from the
release page of KubeVirt:
$ curl -L -o virtctl \
https://github.com/kubevirt/kubevirt/releases/download/$VERSION/virtctl-$VERSION-linux-amd64
$ chmod +x virtctl
Now you are ready to connect to the VMs:
# Connect to the serial console
$ ./virtctl console --kubeconfig ~/.kube/config testvm
# Connect to the graphical display
$ ./virtctl vnc --kubeconfig ~/.kube/config testvm
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.
-
If not installed, install minikube as described here
- Install the kvm2 driver
- Download the
minikube
binary
-
Launch minikube with CNI:
$ minikube start \
--vm-driver kvm2 \
--network-plugin cni
- Install
kubectl
via a package manager or download it