Skip to content
forked from kubevirt/demo

Easy to use KubeVirt demo based on minikube.

Notifications You must be signed in to change notification settings

AsherShoshan/demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

KubeVirt Demo

This demo will guide you through setting up KubeVirt on

Quickstart

Deploy KubeVirt

This demo assumes that minikube (0.28+) (or minishift) is configured and running as described below and that kubectl available on your system. If not, then please take a look at the guide below.

The first step is to start minikube:

$ minikube start --vm-driver kvm2 --feature-gates=DevicePlugins=true --memory 4096
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

# Enable nesting as described [below](#setting-up-minikube)
# OR Enable emulation mode when nested virtualization is not available or you don't want to use it
$ kubectl create configmap -n kube-system kubevirt-config --from-literal debug.useEmulation=true

Note: When deploying KubeVirt on minishift, you will need to install openshift-client-tools and add the following SCCs prior kubevirt.yaml deployment.

Once it is runing KubeVirt can be deployed:

$ export VERSION=v0.11.0
$ kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/$VERSION/kubevirt.yaml

The initial deployment 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.

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 https://github.com/kubevirt/kubevirt/releases/download/$VERSION/virtctl-$VERSION-linux-amd64
$ chmod +x virtctl

Deploy a VirtualMachine

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 vms
$ kubectl get vms -o yaml testvm

# To start a VM you can use
$ ./virtctl start testvm

# Afterwards you can inspect the instances
$ kubectl get vmis
$ kubectl get vmis -o yaml testvm

# To shut it down again
$ ./virtctl stop testvm

# To delete
$ kubectl delete vms testvm
# To create your own
$ kubectl apply -f $YOUR_VM_SPEC

Accessing VMs (serial console & vnc)

# Connect to the serial console
$ ./virtctl console testvm

# Connect to the graphical display
# It Requires remote-viewer from the virt-viewer package.
$ ./virtctl vnc testvm

Next steps

User Guide

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.

Appendix

Setting up Minikube

  1. (Optional) Minikube has support for nested virtualization, it can be enabled as described here.

  2. If not installed, install minikube as described here:

    1. Install the kvm2 driver
    2. Download the minikube binary
  3. Launch minikube with the desired memory

$ minikube start --vm-driver kvm2 --feature-gates=DevicePlugins=true --memory 4096
  1. Install kubectl via a package manager or download it

Running on OKD or minishift

  1. Get the oc tool

  2. Download the openshift-client-tools tarball from here:

  3. Extract the oc tool from the API tool tar xf openshift-origin-client-tools*.tar.gz

  4. Launch oc cluster:

oc cluster up --skip-registry-check --enable=router,sample-templates

In addition to the deployment, grant the KubeVirt components some additional roles:

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

About

Easy to use KubeVirt demo based on minikube.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%