The Kubernetes platform’s evolution allows organizations to revisit how they develop new applications using microservices and containers. As with any new technology there can be the temptation to “move everything to containers”, yet history shows the length of such transitions is measured in years, or even decades. With a major part of the current application landscape residing in virtual machines, the mission of the open source KubeVirt project is to re-imagine virtualization in a Kubernetes world – enabling the use of Kubernetes as a converged platform for running and managing both application containers and virtual machines side by side.
Bringing Kubernetes philosophy, concepts and semantics to virtualization management
When you think about the relationship between containers and virtual machines, the first thought many have is “why not run containers on VMs?”. Certainly this is the way many organizations first start out with containers and Kubernetes. After all, virtual machine infrastructure and management tools are already broadly adopted and more mature than Kubernetes. Virtual machines improved data centers with their ability to abstract hardware maintenance and consolidate workloads, but they can come with a price in performance and a management overhead of an operating system per workload. If we add Kubernetes to the mix, which brings its own orchestration and scheduling, we end up with multiple layers of management and orchestration just to keep our clusters running. With the Kubernetes ecosystem seeking to close the management and ecosystem gaps, KubeVirt can allow us to envision the future data center managed with Kubernetes as its underlying infrastructure, designed to bring the best of both worlds together.
Virtual Machines in a container?
The beauty and simplicity of KVM virtualization is that virtual machines are Linux processes, benefiting from existing Linux features. Virtualization is mostly used in managed environments, orchestrating virtual machines (compute) across a cluster of hosts, network and storage. Kubernetes is orchestrating containers (processes) across a cluster of hosts, network and storage. With KVM virtual machine being a Linux process, why not use Kubernetes to orchestrate virtual machines?
Virtual Machines Managed by Kubernetes
How does it work?
KubeVirt is a Kubernetes add-on consisting of custom resource definitions (CRDs), controllers and an operator leveraging a range of Kubernetes extension mechanisms. KubeVirt provides an API for virtualization with the same concepts as other Kubernetes entities, patterns and tools. Using Kubernetes and KubeVirt allows us to launch containers and virtual machines on the same cluster, same node, using the same networks and same storage infrastructure.
It's about balance
Virtual machines have different semantics than containers. For virtual machines, one needs to describe some aspects of the virtual hardware, and since applications in virtual machines usually mix the application with its data, persistent storage is needed. There may be expectations such as layer 2 networks, PXE boot for provisioning, cloning images and live migration.
KubeVirt is designed to maintain a balance by providing virtualization capabilities, yet keeping the Kubernetes philosophy and semantics. This enables a transition path where virtual machines can behave the same as before but also leverage Kubernetes infrastructure, tools, management.
KubeVirt also allows virtual machines to benefit from features in Kubernetes, using the various storage classes, networking concepts from overlay networks to routes and load balancers, multi-tenancy, RBAC, integrated monitoring and logging, and service mesh.
It’s good for Kubernetes too
Virtualization has many mature concepts. Bringing virtualization to Kubernetes can mean a broader community investing in tools augmenting Kubernetes like Containerized Data Importer (CDI) allowing clone/upload/download/export/import content for PersistentVolumes, fencing to provide high availability for containers (for example, when using PersistentVolumes), layer 2 networking, device passthrough (SR-IOV, GPU), bare metal hardware management, CSI drivers for advanced storage offloading and enhanced management.
Closing the loop - A feasible path forward
At Red Hat Summit 2018, we demoed how one can import a virtual machine to OpenShift, start modernizing and containerizing it, with the virtual machine behaving like a container in OpenShift, exposing or consuming OpenShift services and routes. As organizations adopt Kubernetes, they can bring along their virtual machines, manage them together side by side with containers starting as virtual machines, transitioning them to leverage Kubernetes for virtualization, or to containerize the apps.
Check out KubeVirt in our "Getting Started with KubeVirt" post, also published this morning.