• Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easy to use KubeVirt demo based on minikube.

Build Status

KubeVirt Demo

This demo will guide you through setting up KubeVirt on

Quickstart

Deploy KubeVirt

This demo assumes that minikube 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 config set vm-driver kvm2
$ minikube start --memory 4096
๐Ÿ˜„  minikube v1.0.1 on linux (amd64)
๐Ÿ’ฟ  Downloading Minikube ISO ...
 142.88 MB / 142.88 MB [============================================] 100.00% 0s
๐Ÿคน  Downloading Kubernetes v1.14.1 images in the background ...
๐Ÿ”ฅ  Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
๐Ÿ“ถ  "minikube" IP address is 192.168.39.47
๐Ÿณ  Configuring Docker as the container runtime ...
๐Ÿณ  Version of container runtime is 18.06.3-ce
โŒ›  Waiting for image downloads to complete ...
โœจ  Preparing Kubernetes environment ...
๐Ÿ’พ  Downloading kubelet v1.14.1
๐Ÿ’พ  Downloading kubeadm v1.14.1
๐Ÿšœ  Pulling images required by Kubernetes v1.14.1 ...
๐Ÿš€  Launching Kubernetes v1.14.1 using kubeadm ...
โŒ›  Waiting for pods: apiserver proxy etcd scheduler controller dns
๐Ÿ”‘  Configuring cluster permissions ...
๐Ÿค”  Verifying component health .....
๐Ÿ’—  kubectl is now configured to use "minikube"
๐Ÿ„  Done! Thank you for using minikube!

Before we can deploy KubeVirt we create a small config, to adjust KubeVirt to your environment. Specifically enabling software emulation for your VMs in case that no hardware virtualization support is present.

$ kubectl create namespace kubevirt

# Either nesting as described [below](#setting-up-minikube) will be used, or we configure emulation if
# no nesting is available:
$ minikube ssh -- test -e /dev/kvm \
  || kubectl create configmap -n kubevirt kubevirt-config --from-literal debug.useEmulation=true

Now you are finally ready to deploy KubeVirt using our operator (comparable to an installer):

$ kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v0.34.2/kubevirt-operator.yaml
โ€ฆ
deployment.apps/virt-operator created

$ kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v0.34.2/kubevirt-cr.yaml
kubevirt.kubevirt.io/kubevirt created

The initial deployment can take a long time, because a number of pods have to be pulled from the internet. We'll watch the operator status to determine when the deployment is completed:

$ kubectl wait --timeout=180s --for=condition=Available -n kubevirt kv/kubevirt
kubevirt.kubevirt.io/kubevirt condition met

Congratulations, KubeVirt was successfully deployed.

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/v0.34.2/virtctl-v0.34.2-linux-amd64
$ chmod +x virtctl

Installing with krew

If you installed krew, you can install virtctl as a kubectl plugin:

$ kubectl krew install virt

Starting and stopping a VirtualMachine

Once you deployed KubeVirt you are ready to launch a VM:

if virtctl is installed via krew, please use kubectl virt ... instead of ./virtctl ...

# 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 describe vm testvm

# To start a VM you can use, this will create a VM instance (VMI)
$ ./virtctl start testvm

# The interested reader can now optionally inspect the instance
$ kubectl describe vmi testvm

# To shut the VM down again:
$ ./virtctl stop testvm

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

Accessing VMs (serial console & VNC)

if virtctl is installed via krew, please use kubectl virt ... instead of ./virtctl ...

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

# Connect to the graphical display
# This requires remote-viewer from the virt-viewer package and a graphical desktop from where you run virtctl
$ ./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 --memory 4096
  1. Install kubectl via a package manager or download it

Setting up kind

  1. If not installed, install kind as described here

  2. Launch kind

$ tee cluster.yaml <<EOC
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
- role: worker
- role: worker
EOC

$ kind create cluster --config cluster.yaml

Running on CRC

CRC is just another Kubernetes distribution, and you can also use kubectl to interact with such a cluster. However, the oc tool is part of OKD and provides additional commands for managing your cluster.

  1. Get the crc tool

  2. Follow the steps at https://github.com/code-ready/crc/releases to get and install CRC

More Repositories

1

kubevirt

Kubernetes Virtualization API and runtime in order to define and manage virtual machines.
Go
5,411
star
2

containerized-data-importer

Data Import Service for kubernetes, designed with kubevirt in mind.
Go
418
star
3

hyperconverged-cluster-operator

Operator pattern for managing multi-operator products
Go
148
star
4

kubevirt-ansible

Set of Ansible roles & playbooks for KubeVirt deployment
Go
91
star
5

common-templates

Templates for running VMs on KubeVirt
Shell
80
star
6

kubevirtci

Contains cluster definitions and client tools to quickly spin up and destroy ephemeral and scalable k8s and ocp clusters for testing
Shell
79
star
7

hostpath-provisioner

Go
78
star
8

cloud-provider-kubevirt

Kubernetes cloud-provider for KubeVirt
Go
72
star
9

cluster-network-addons-operator

Deploy additional networking components on top of your Kubernetes cluster
Go
71
star
10

user-guide

This user guide will walk you through installation and various features.
Makefile
63
star
11

hostpath-provisioner-operator

Go
52
star
12

community

Community content
Python
49
star
13

node-maintenance-operator

A Kubernetes Operator to manage node maintenance through NodeMaintenance custom resources
Go
43
star
14

kubernetes-device-plugins

Incubating: A number of Kubernetes device-plugins developed and useful for KubeVirt
Go
43
star
15

macvtap-cni

A CNI + device plugin combo for virtualization workloads on Kubernetes.
Go
42
star
16

csi-driver

KubeVirt CSI driver
Go
39
star
17

libvirt

DEPRECATED Vanilla dockerized libvirt image, used as a base for kubevirt
Shell
39
star
18

client-go

Go client for kubevirt
Go
38
star
19

kubevirt-tutorial

Demo that guides users through an end to end KubeVirt experience.
HCL
30
star
20

kubevirt.github.io

KubeVirt website repo, documentation at https://kubevirt.io/user-guide/
HTML
30
star
21

kubevirt-tekton-tasks

VM specific tasks for Tekton Pipelines
Go
29
star
22

ssp-operator

Operator that deploys additional KubeVirt resources
Go
29
star
23

device-plugin-manager

Incubating: A framework for writing Kubernetes Device Plugins
Go
29
star
24

kubevirt-velero-plugin

Plugin to Velero which automates backing up and restoring KubeVirt/CDI objects
Go
28
star
25

client-python

An auto-generated python SDK to interact with KubeVirt resources
Python
28
star
26

terraform-provider-kubevirt

Terraform provider for Kubevirt platform
Go
27
star
27

containerdisks

Officially built and maintained containerdisks of the KubeVirt project
Go
25
star
28

project-infra

Project infrastructure administrative tools
Go
25
star
29

monitoring

KubeVirt monitoring dashboards
Go
24
star
30

common-instancetypes

Instancetypes and preferences for running VMs on KubeVirt
Go
22
star
31

vm-import-operator

Operator for importing VMs from RHV to KubeVirt
Go
16
star
32

vAdvisor

VM monitoring application based on WSGI, libvirt, flask and gevent, inspired by cAdvisor.
Python
14
star
33

vmctl

Use KubeVirt VMs with Deployments, Replica Sets, โ€ฆ
Go
13
star
34

must-gather

A client tool for gathering KubeVirt informations in a Kubernetes or OpenShift cluster
Shell
12
star
35

web-ui-operator

Operator for web-ui
Go
12
star
36

kubevirt.core

Lean Ansible bindings for KubeVirt
Python
11
star
37

api

KubeVirt API definition
Go
11
star
38

kubectl-virt-plugin

Holds all scripts to create packages and manifest file required for publishing the virtctl binary as a krew package for kubectl.
Shell
11
star
39

machine-remediation

Incubating: Deploy all components to recognize unhealthy machines and apply different remediation strategies on it
Go
10
star
40

api-reference

API documentation
HTML
8
star
41

web-ui-components

https://kubevirt.io/web-ui-components
JavaScript
8
star
42

bridge-marker

Shell
7
star
43

managed-tenant-quota

Go
7
star
44

kubevirt-ssp-operator

Shell
7
star
45

ansible-kubevirt-modules

Ansible modules for managing KubeVirt objects in Kubernetes clusters
Shell
7
star
46

kubesecondarydns

DNS for KubeVirt VirtualMachines secondary interfaces
Go
7
star
47

cluster-api-provider-external

The external provider implementation of the Cluster Management API.
Go
6
star
48

vm-console-proxy

Proxy for VM console connection.
Go
6
star
49

cloud-image-builder

Scripts and playbooks for creating and testing cloud images containing Kubernetes and KubeVirt
Shell
6
star
50

ci-health

Metrics about CI performance in repositories using Prow
Go
5
star
51

run

This repository is backing run.kubevirt.io.
Shell
5
star
52

controller-lifecycle-operator-sdk

Go
4
star
53

application-aware-quota

Empower users to customize and manage resource quotas per component in Kubernetes, utilizing the scheduling gates feature.
Go
4
star
54

katacoda-scenarios

Training scenarios for https://katacoda.com/kubevirt
Shell
4
star
55

v2v-job

A job to allow importing a VM from a support virt-v2v source into KubeVirt.
Shell
4
star
56

kubevirt-operator

Incubating: The KubeVirt Operator
Go
4
star
57

tekton-tasks-operator

Operator which deploys kubevirt-tekton-tasks in cluster
Go
3
star
58

kubevirt-template-validator

validating webhook to check templates sent to the cluster.
Go
3
star
59

containerized-data-importer-api

Containerized Data Importer API definitions
Go
3
star
60

web-ui-design

Images and Markdown documenting proposed user workflows for the UI
HTML
3
star
61

qe-tools

Different Ginkgo reporters for QE purposes
Go
3
star
62

test-infra-containers

All containers which are useful for testing (tgtd, cinder, ceph, gluster, ...)
Shell
2
star
63

cdi-operator

Makefile
2
star
64

k8s-seccomp-generator

Generates seccomp profile for kubernetes pods
Go
2
star
65

test-benchmarks

setup to create reproducible benchmarks tests with containers and KubeVirt VMs
Go
2
star
66

cockpit-demo

This is a demonstration of how KubeVirt could be displayed in Cockpit
JavaScript
2
star
67

libguestfs-appliance

Builds libguestfs appliances and container images to be consumed by other kubevirt projects
Dockerfile
2
star
68

cdi-api-reference

Containerized Data Importer API Reference
HTML
1
star
69

sig-release

A repo to hold and organize all the information required for KubeVirt releases
1
star
70

.github

Default Community health files.
1
star
71

kvm-info-nfd-plugin

Plugin for Kubernetes Node Feature Discovery for high(er) level KVM featues
C
1
star
72

node-labeller

Node-Labeller is deprecated and is moved to kubevirt repository
Go
1
star