Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Managing Virtual Machines on Kubernetes

Kunal Kushwaha
February 26, 2019

Managing Virtual Machines on Kubernetes

Introduction to KubeVirt which enables to run VMs along with Containers on Kubernetes.

Kunal Kushwaha

February 26, 2019

More Decks by Kunal Kushwaha

Other Decks in Technology


  1. VM Platform oVirt/VMWare ESX/OpenStack/Cloud app-1 app-2 app-N VM Platform oVirt/VMWare

    ESX/OpenStack/Cloud app-1 app-2 kernel app-N app-1 app-2 app- M Current Situation in Enterprise Existing Products New Products Fragmentation VM VM VM
  2. Why still use Virtual Machine? - Learning and planning for

    migrating existing Applications to Containers - Migration also means cost. - Not only requires Ops team but development team too. (complete software cycle) - Not all applications can be Containerized - Application designed for custom kernel? - Needs specific kernel parameters. - Lack of knowledge / Too complex to migrate in containers. - Application towards end of life.
  3. So what we want? • Run VM and containers in

    same platform i.e. Kubernetes • Let containers and VM interact as any kubernetes pods do. • Yet let VM to behave as VM, not application containers. VM Platform oVirt/VMWare ESX/OpenStack/Cloud app-1 app-2 app-N app-1 app-2 kernel app-N app-1 app-2 app- M
  4. How to run VM in Kubernetes? - Kata Containers? -

    Runs application containers with VM level isolation. - Essentially runs VM as container - We need VM to run as VM, not containers ! KubeVirt
  5. KubeVirt - Enables to run VM along with containers on

    Kubernetes. - Implemented as CRD (Custom Resource Definition) - Can be installed on existing Kubernetes cluster. - VM’s live in Pod (Transparent to monitoring API’s) - Uses kvm, qemu, libvirt runtime stack to run VM. - VM’s can interact with pods in cluster. - Helps in easy migration of existing applications. - Helps in Lift and Shift approach KubeVirt
  6. Control Flow & Architecture API Server Virt Controller Kubelet Virt

    handler app-1 POD app-2 POD app-3 Kube Master Kube Node(s)
  7. How to interact? - Kubectl - KubeVirt Objects - VirtualMachine

    & VirtualMachineInstance - Management of VM & VMI objects - Virtctl - Interaction with VM’s - Accessing console, VNC - Creating services to access VM ports - GUI - Overall Management. - https://github.com/kubevirt/web-ui
  8. Example YML --- apiVersion: kubevirt.io/v1alpha3 kind: VirtualMachineInstance metadata: labels: special:

    vmi-fedora name: vmi-fedora spec: domain: devices: disks: - disk: bus: virtio name: containerdisk - disk: bus: virtio name: cloudinitdisk machine: type: "" resources: requests: memory: 1024M terminationGracePeriodSeconds: 0 volumes: - containerDisk: image: kubevirt/fedora-cloud-container-disk-demo:devel name: containerdisk - cloudInitNoCloud: userData: |- #cloud-config password: fedora chpasswd: { expire: False } name: cloudinitdisk
  9. Important Commands • Create a virtual machine instance. $ Kubectl

    apply -f fedora.yaml • Get list of all virtual machine instance $ kubectl get vmi • Describe instance of virtual machine instance $ kubectl describe vmi vm-fedora • Create services and expose ports. $ virtctl expose vmi vm-fedora --name <Service-name> • Like exec for containers. $ virtctl console vm-fedora • Access GUI of Virtual machine $ virtctl vnc vm-fedora
  10. Key Points - Networking - Backend: Expose to actual networking

    infrastructure in cluster - Pod, Multus & Genie (CNI plugins supporting dozen of solutions) - Frontend: VM networking. - Bridge, NAT, Slirp & SR-IOV - Storage (Disks & Volume) - Disk types - LUN (iSCSI),disk, floppy, CD Rom - Volumes - Temporary(VM life cycle) & persistent volume both are supported - Virtio drivers for Microsoft Windows - Supports Live Migration - Probes for health check and monitoring.