Herding Virtual Machines

on Kubernetes using KubeVirt.

Fabian Deutsch, Red Hat, FrOSCon, 2017

(saomik, CC BY-NC-ND 2.0)

Fabian Deutsch

Fedora User

oVirt and KubeVirt Contributor ⇝ kubevirt.io

Working at Red Hat

 

@dummdida

fabiand

Virtualization is omnipresent. today.

(drome, CC BY-NC 2.0)

Containers as well.

(davehamster, CC BY 2.0)

Containers look, taste, and
smell the same - just better

"Versatile, scalable, hyped, community driven, devops, …"
Take this with a grain of salt.

(colinwarren, CC BY-NC 2.0)

How do we get there?

 

"Can I replace my VMs with containers?"

Are they REALLY substitutes?
Is the one like the other?

Technology? Features? Feeling? Tools? Requirements?

⇝ It depends

Not yet?
"never"?

Yes

No

Cool

Replace?

We are here, because we assume a change.

From scratch?

(teflon, CC BY-NC-ND 2.0)

Evolve.

(coreyann, CC BY-ND 2.0)

Management Plane

Storage

Network

 

Virtual Machines

 

Management Plane

Storage

Network

 

Virtual Machines

 

Management Plane

Storage

Network

 

Containers

 

2x Infrastructure?

Management Plane

Storage

Network

 

Virtual Machines

 

Management Plane

Storage

Network

 

Containers

 

KubeVirt

Containers
&
Virtual Machines

on the same infrastructure.

Management Plane

Storage

Network

 

Virtual Machines

 

 

Containers

 

Keep your VMs …

Management Plane

Storage

Network

 

Virtual Machines

 

 

Containers

 

… Transition what you need …

Management Plane

Storage

Network

 

Virtual Machines

 

 

Containers

 

… And stick to VMs as needed.

Woot?

Tell me more.

(image source: giphy)

Kubernetes

Storage

Network

 

Virtual Machines

 

 

Containers

 

Kubernetes

Storage

Network

 

Virtual Machines

 

 

Containers

 

+ KubeVirt

Pillars and effects.

libvirt, … everything in pods

 

New resource type for VMs

 

Operator pattern to manage VMs

 

VMs live inside pods

Native Kubernetes add-on

 

API server with VM functionality

 

Declarative, like everything else

 

Kubernetes' infrastructure is leveraged

 

 

 

(tabor-roeder, CC BY 2.0)

$ kubectl create -f pod.yaml
$ kubectl create -f vm.yaml
apiVersion: kubevirt.io/v1alpha1
kind: VM
metadata:
  name: testvm
spec:
  domain:
    devices:
      graphics:
      - type: spice
      video:
      - type: qxl
      disks:
      - type: network
        snapshot: external
        device: disk
        driver:
          name: qemu
          type: raw
          cache: none
        source:
          host:
            name: iscsi-demo-target.default
            port: "3260"
          protocol: iscsi
          name: iqn.2017-01.io.kubevirt:sn.42/2
        target:
          dev: vda
      consoles:
      - type: pty
    memory:
      unit: MB
      value: 64

$ minikube start --vm-driver kvm --network-plugin cni

$ git clone -b froscon-2017 \

        https://github.com/fabiand/kubevirt-demo.git

$ cd kubevirt-demo

$ bash run-mini-demo.sh

Try (with minikube)

$ bash run-mini-demo.sh
# Deploying KubeVirt
...
vm "testvm" created
Waiting for KubeVirt to be ready ...
Waiting for KubeVirt to be ready ...
Waiting for KubeVirt to be ready ...
# KubeVirt is now ready. Try:
# $ kubectl get vms

$ kubectl get vms
NAME      KIND
testvm    VM.v1alpha1.kubevirt.io

$ kubectl get pods
NAME                                      READY     STATUS    RESTARTS   AGE
haproxy-723816479-wcblm                   1/1       Running   1          49s
iscsi-demo-target-tgtd-1270025779-nckbh   1/1       Running   0          48s
libvirt-8zj1k                             2/2       Running   0          48s
spice-proxy-3525077118-fswn9              1/1       Running   0          47s
virt-api-1956313626-t9rhj                 1/1       Running   0          46s
virt-controller-2251532855-tfm9f          1/1       Running   0          45s
virt-handler-s7g76                        1/1       Running   0          43s
virt-launcher-testvm-----q05vh            1/1       Running   0          38s
virt-manifest-1665692876-cs8wp            2/2       Running   0          42s

$ kubectl exec -it libvirt-8zj1k bash
Defaulting container name to libvirtd.
Use 'kubectl describe pod/libvirt-8zj1k' to see all of the containers in this pod.
# virsh list
 Id    Name                           State
----------------------------------------------------
 1     default_testvm                 running

# exit

Thank you.

Learn and contribute at http://kubevirt.io

Herding Virtual Machines on Kubernetes using KubeVirt.

By Fabian Deutsch

Herding Virtual Machines on Kubernetes using KubeVirt.

Learn about one way to run virtual machines on Kubernetes.

  • 3,101