This repository contains helper scripts and YAML files to facilitate performing a simple demonstration of the KubeVirt project and related components including the Containerized Data Importer.
The demonstration environment is created using Minishift and is as a result appropriate for running on a single laptop.
Currently before running the demonstration script it is necessary to download and install:
minishift
kubectl
virtctl
The host system must also be enabled for nested KVM. KubeVirt and the Containerized Data Importer will be installed by the demo scripts.
Execute demo.sh
to create the base minishift environment:
$ ./demo.sh
This creates a new minishift environment and deploys KubeVirt as well as the Containerized Data Importer.
As pulling the images and starting them takes some time, particularly on conference wifi, this is typically a step to perform before the demonstration so that time is focused instead on what the resultant setup can actually do.
Once the system is ready, use the provided YAML files to (re)create the examples
in the kubevirt-demo
namespace that will be selected when demo.sh
ends. To
clean-up the examples you can use clean.sh
. This will only remove newly
created entities generated from the YAML files in the current namespace. It will
not clean up the MiniShift instance or other KubeVirt entities like the CRDs.
The following examples use the Cirros disk image and are found in
./examples/cirros/
:
cirros-vm.yaml
- Create a basic Cirros virtual machine using aRegistryDisk
, pulls image from Docker Hub.cirros-pvc.yaml
- Create aPersistentVolume
containing a Cirros disk image using the Containerized Data Importer,img
file pulled via HTTP.cirros-pvc-vm.yaml
- Create a basic Cirros virtual machine using aPersistentVolume
.cirros-clone-pvc.yaml
- Create a clone of thePersistentVolume
created bycirros-pvc.yaml
using the Containerized Data Importer.cirros-clone-vm.yaml
- Create a virtual machine based on the clonedPersistentVolume
fromcirros-clone-pvc.yaml
.
The fedora-*
examples in ./examples/fedora/
follow the same pattern as the
Cirros examples above. In both the Cirros and Fedora examples the resultant
virtual machine has basic networking provided by the Pod
network. The Cirros
image uses the default username and password baked into it (cirros
and
gocubsgo
), the Fedora image uses the shadowman
user with the shadowman
password.
Once the environment is operational, it is ready for demonstration. A typical basic flow looks something like this:
- Examine the
kube-system
namespace illustrating the presence of the KubeVirt components. - Use
kubectl create -f examples/cirros/cirros-vm.yaml
to create a basic Cirros virtual machine based on aRegistryDisk
. - Use
kubectl get vms
to illustratekubectl
can see the vm object. - Use
kubectl edit vm cirros-vm
orvirtctl start cirros-vm
to create theVirtualMachineInstance
. - Use
kubectl get vmis
to illustrate the presence of the VM instance. - Use
kubectl describe vmi cirros-vm
to see the scheduling state of the virtual machine instance. - Use
virtctl console cirros-vm
to access the console of the virtual machine instance.
The Containerized Data Importer allows us to demonstrate spawning a virtual
machine that uses a PersistentVolume
instead of a RegistryDisk
.
- Use
kubectl create -f examples/cirros/cirros-pvc.yaml
to create the CirrosPersistentVolume
. - Use
watch -n 2 kubectl logs <pod>
to illustrate the state of the import process. - Use
kubectl create -f examples/cirroscirros-pvc-vm.yaml
to create a basic Cirros virtual machine based on aPersistentVolume
. - Use
kubectl create -f examples/cirroscirros-clone-pvc.yaml
to demonstrate cloning a volume. - Use
kubectl create -f examples/cirros/cirros-clone-vm.yaml
to demonstrate spawning a virtual machine from the cloned volume.