Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kubevirt/demo
Easy to use KubeVirt demo based on minikube.
https://github.com/kubevirt/demo
demo kubernetes libvirt minikube qemu virtualization
Last synced: about 2 months ago
JSON representation
Easy to use KubeVirt demo based on minikube.
- Host: GitHub
- URL: https://github.com/kubevirt/demo
- Owner: kubevirt
- License: apache-2.0
- Created: 2017-01-04T14:54:17.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2021-10-06T13:28:38.000Z (about 3 years ago)
- Last Synced: 2024-08-01T20:48:55.752Z (5 months ago)
- Topics: demo, kubernetes, libvirt, minikube, qemu, virtualization
- Language: Shell
- Homepage:
- Size: 257 KB
- Stars: 108
- Watchers: 17
- Forks: 59
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/kubevirt/demo.svg?branch=master)](https://travis-ci.org/kubevirt/demo)
# KubeVirt Demo
This demo will guide you through setting up [KubeVirt](https://www.kubevirt.io) on
- [minikube](#setting-up-minikube) 1.2+
- [kind](#setting-up-kind) 0.4+
- CRC 1.18+## Quickstart
### Deploy KubeVirt
This demo assumes that `minikube` or `minishift` is [configured and running as described
below](#setting-up-minikube) and that `kubectl` available on your system. If not, then
please take a look at the guide [below](#setting-up-minikube).The first step is to start `minikube`:
```bash
$ 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.```bash
$ 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):
```bash
$ 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:```bash
$ 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:```bash
$ 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](https://krew.dev), you can install virtctl as a kubectl plugin:
```bash
$ 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 ...`*
```bash
# 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 ...`*
```bash
# 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](https://kubevirt.io/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](https://docs.fedoraproject.org/en-US/quick-docs/using-nested-virtualization-in-kvm/).
2. If not installed, install minikube as described [here](https://github.com/kubernetes/minikube/):
1. Install the [kvm2 driver](https://minikube.sigs.k8s.io/docs/drivers/kvm2/)
2. Download the [`minikube` binary](https://github.com/kubernetes/minikube/releases)3. Launch minikube with the desired memory
```bash
$ minikube start --vm-driver kvm2 --memory 4096
```3. Install `kubectl` via a [package manager](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-native-package-management) or [download](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl) it
### Setting up `kind`
1. If not installed, install kind as described [here](https://github.com/kubernetes-sigs/kind)
2. Launch kind
```bash
$ tee cluster.yaml <