KubeVirt & OpenShift CNV — Why does it make sense

A B Vijay Kumar
Aug 8 · 5 min read

KubeVirt & OpenShift CNV is changing the way we look at Virtual Machines, and VM orchestration, by bringing in the goodness of k8s. This blog, I will share my thoughts about how this will transform our journey to the cloud.

Why KubeVirt & CNV???

I had various questions when I heard about container-native Virtualization (CNV) & KubeVirt — I was asking myself.

“I thought I am moving away from VM to containers!!! and Why would I run a VM inside a container”

It didn’t take much time to realize, that the enterprises have already invested in stabilizing a lot of core business systems that are running on VMs. As the first safest step towards “journey to the cloud”, is to “lift-shift” the workloads quickly to the cloud. This has an immediate impact on the TCO, and helps move more towards the OPEX model, and leverage the elasticity of the cloud!!

now if they have to lift and shift..there are a lot of systems that are already virtualized and working on VMs…it makes a lot of sense to quickly move these workloads!!

now, why can't they just use the matured VM orchestrations…

now again if you look at the journey to cloud — it would not stop at lift and shift — to leverage the real value of the cloud, we have to modernize the applications and move towards cloud-native architectures and consume native services— which means the next obvious step is to go towards microservices architecture??..of breaking down the monolith to an extent, where there is also functional scalability, agility and elasticity, hence the container-based deployments & container orchestration such as k8s is critical

so in the process, enterprises end up having 2 orchestrations — VMs and Containers

Aha moment!!! how it would be as we take the first step towards cloud (lift and shift) to directly deploy VM workloads on Kube, and later worry about breaking monoliths in iterations..thats when CNVs make sense

Another key point!!! are all workloads container ready?? nope!!! I have come across so many which are not container ready…and most of them are COTS!!! so CNV all of a sudden, makes more sense…double Aha moment!!

So what is KubeVirt???

KubeVirt comes to the rescue for managing VMs as Pods!!..

KubeVirt is an open-source project that provides a way to run VMs as Pods and co-exist in the k8s cluster. It leverages KVM (linux kernel hypervisor) to provide container-native virtualisation (CNV)

Here is how it stacks up

Image for post
Image for post

and here is how it enables co-existence of VMs and Containers

Image for post
Image for post

The cool part is that the way you would use the storage, networking, monitoring is all like how you would in a typical k8s cluster!!!!

How does it work??

Image for post
Image for post
  • virt-controller: Responsible for cluster-wide virtualization .
  • virt-handler: responsible for handling operations to change a VM to meet the required state.
  • virt-launcher: Each VM is created in a Pod, virt-launcher runs in the primary container of the pod, to provide the cgroups and namespaces which will be used to host the VM process
  • libvirtd: manages the life-cycle of the VM process, stays in every pod.
  • qemu: is the open-source machine emulator that runs the VM

We will need KuberVirt and Container Data Importer (CDI) Operators and CRDs to be applied to our cluster (using kubectl apply -f).

CDI is a utility to import, upload, and clone VM images.

  • KubeVirt Operator:
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v0.26.0/kubevirt-operator.yaml
  • KubeVirt CRDs:
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/v0.26.0/kubevirt-cr.yaml
  • CDI Operator:
kubectl apply -f https://github.com/kubevirt/containerized-data-importer/releases/download/v1.18.2/cdi-operator.yaml
  • CDI CRDs:
kubectl apply -f https://github.com/kubevirt/containerized-data-importer/releases/download/v1.18.2/cdi-cr.yaml

Convert VMs to KubeVirt

The disk image of the VM needs to be used as the bootable image for KubeVirt VM. PV with the disk image needs to be attached as a CD-ROM to the VM… and using virtctl image-upload command the VM is automatically created. Here is a sample of how a windows ISO can be used to create an image on PV of the requested size to cdi-apiserver and uploading the file to cdi-uploadproxy.

virtctl image-upload \
--image-path= <path to ISO> \
--pvc-name=iso-win2k12 \
--access-mode=ReadOnlyMany \
--pvc-size=5G \
--uploadproxy-url=https://10.96.164.35:443 \
--insecure \
--wait-secs=240

The data inside is by default ephemeral, however, PVC can be used like how we typically use for container, and persist the data.

All this is cool!!!

You can monitor the VMs as how you would monitor containers with Prometheus

Enter the “OpenShift CNV”

Being an IBMer, I was wondering …

What does OpenShift bring above and beyond this!!!

OpenShift CNV is the Red Hat version of KubeVirt, that allows you to run VMs alongside containers on OpenShift Platform!!! isn’t that cool!! so you get all the goodies that you would get with Red Hat OpenShift Container Platform (vs DYI K8s) & the ease of DevOps & Management.

Refer to this blog https://www.openshift.com/blog/blog-openshift-virtualization-whats-new-with-virtualization-from-red-hat

Here is what I copied from that blog for reference..you can go to that blog, for more details

Image for post
Image for post

That's all for now!!!

I will be back with a hands-on how to run Windows on OpenShift CNV…

ttyl

References

Image for post
Image for post

Subscribe to FAUN topics and get your weekly curated email of the must-read tech stories, news, and tutorials 🗞️

Follow us on Twitter 🐦 and Facebook 👥 and Instagram 📷 and join our Facebook and Linkedin Groups 💬

Image for post
Image for post

FAUN

The Must-Read Publication for Creative Developers & DevOps Enthusiasts

By FAUN

Medium’s largest and most followed independent DevOps publication. Join thousands of aspiring developers and DevOps enthusiasts Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

A B Vijay Kumar

Written by

IBM Distinguished Engineer, Master Inventor, Mobile, RPi & Cloud Programmer

FAUN

FAUN

The Must-Read Publication for Creative Developers & DevOps Enthusiasts. Medium’s largest DevOps publication.

A B Vijay Kumar

Written by

IBM Distinguished Engineer, Master Inventor, Mobile, RPi & Cloud Programmer

FAUN

FAUN

The Must-Read Publication for Creative Developers & DevOps Enthusiasts. Medium’s largest DevOps publication.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store