KubeVirt Implementation: Who Needs It and Why?

The adoption of cloud-native architectures and containerization is transforming the way we develop, deploy, and manage applications. Containers offer speed, agility, and scalability, fueling a significant shift in IT strategies. However, the reality for many organizations is that virtual machines (VMs) continue to play a critical role, especially when it comes to legacy or stateful applications. Even leading financial institutions like Goldman Sachs recognize the value of VMs alongside containerized workloads and are exploring ways to manage them efficiently. 

This creates a potential divide: the benefits of containerization on one side and the enduring need for VMs on the other. KubeVirt bridges this gap by extending the power of Kubernetes to virtual machine management, giving you the ability to unify your infrastructure while enabling a smoother transition to cloud-native technologies.

In this article, we explore why KubeVirt is a compelling solution for organizations seeking to streamline IT operations and gain flexibility in a hybrid infrastructure environment.

What Exactly is KubeVirt?

KubeVirt is an open-source project that transforms Kubernetes into a powerful platform capable of managing both containers and virtual machines. Put simply, KubeVirt turns Kubernetes into a single control plane for your entire infrastructure.

Here’s how it works:

Think of KubeVirt as enabling Kubernetes to speak the language of virtualization, opening a world of possibilities for your infrastructure management.

The Business Impact of KubeVirt

KubeVirt delivers tangible benefits that go beyond technical elegance. By adopting KubeVirt, your organization stands to gain the following:

Why Should Your Organization Care?

KubeVirt delivers compelling value, especially in these areas:

Here are some specific pain points that KubeVirt addresses:

Getting Started: Deployment and Implementation

Deploying KubeVirt requires a well-prepared Kubernetes environment. This section provides a detailed guide to help you set up and implement KubeVirt in your infrastructure.

Prerequisites

Before you begin, ensure the following requirements are met:

1. Kubernetes Cluster

You need a Kubernetes cluster (or a derivative such as OpenShift) based on one of the latest three Kubernetes releases available at the time of the KubeVirt release.

2. Kubernetes API Server Configuration

The Kubernetes API server must be configured with --allow-privileged=true to run KubeVirt's privileged DaemonSet.

3. Kubectl Utility

Ensure you have the kubectl client utility installed and configured to interact with your cluster.

4. Container Runtime Support

KubeVirt is supported on the following container runtimes:

Other container runtimes should work as well, but the mentioned ones are the primary targets.

5. Hardware Virtualization

Hardware with virtualization support is recommended. You can use virt-host-validate to ensure your hosts are capable of running virtualization workloads:

YAML
 
$ virt-host-validate qemu


Network and Security Considerations

  1. Network Configuration: Plan how your VMs will connect and interact with external networks and the rest of your Kubernetes environment.

  2. AppArmor Integration: On systems with AppArmor enabled, you might need to modify the AppArmor profiles to allow the execution of KubeVirt-privileged containers. For example:

YAML
 
# vim /etc/apparmor.d/usr.sbin.libvirtd
/usr/libexec/qemu-kvm PUx,
# apparmor_parser -r /etc/apparmor.d/usr.sbin.libvirtd


KubeVirt Installation

To install KubeVirt, follow these steps:

1. Install the KubeVirt Operator

The KubeVirt operator simplifies the installation and management of KubeVirt components. Run the following commands to deploy the latest KubeVirt release:

YAML
 
# Point at latest release
$ export RELEASE=$(curl https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirt/stable.txt)
# Deploy the KubeVirt operator
$ kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/kubevirt-operator.yaml
# Create the KubeVirt CR (instance deployment request) which triggers the actual installation
$ kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/kubevirt-cr.yaml
# Wait until all KubeVirt components are up
$ kubectl -n kubevirt wait kv kubevirt --for condition=Available


2. Configuration for Non-Hardware Virtualization

If hardware virtualization is not available, enable software emulation by setting useEmulation to true in the KubeVirt CR:

YAML
 
$ kubectl edit -n kubevirt kubevirt kubevirt
# Add the following to the kubevirt.yaml file
spec:
configuration:
developerConfiguration:
useEmulation: true


Implementation Best Practices

To get the most out of KubeVirt, follow these best practices:

1. Conduct a Workload Assessment

Prioritize VMs that are suitable for containerization. Start with less mission-critical applications to gain practical experience.

2. Assess Networking and Storage

Plan how to bridge VM networking with your existing Kubernetes networking and integrate storage solutions for persistent data using Container Storage Interface (CSI) plugins.

3. Emphasize Monitoring and Management

Use Kubernetes monitoring tools or explore KubeVirt-specific solutions to gain visibility into VM performance alongside your containers.

4. Live Migration

Enable and configure live migration to move running VMs to other compute nodes without downtime. This involves setting feature gates and configuring migration-specific parameters in the KubeVirt CR:

YAML
 
apiVersion: kubevirt.io/v1
kind: KubeVirt
metadata:
name: kubevirt
namespace: kubevirt
spec:
configuration:
developerConfiguration:
featureGates:
- LiveMigration
migrations:
parallelMigrationsPerCluster: 5
parallelOutboundMigrationsPerNode: 2
bandwidthPerMigration: 64Mi
completionTimeoutPerGiB: 800
progressTimeout: 150


Example Installation on OpenShift (OKD)

If you're using OKD, additional steps include configuring Security Context Constraints (SCC):

YAML
 
$ oc adm policy add-scc-to-user privileged -n kubevirt -z kubevirt-operator


Example Installation on k3OS

For k3OS, ensure you load the required modules on all nodes before deploying KubeVirt:

YAML
 
k3os:
modules:
- kvm
- vhost_net


Restart the nodes with this configuration and then deploy KubeVirt as described above.

Installation of Daily Developer Builds

For the latest developer builds, run:

YAML
 
$ LATEST=$(curl -L https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/latest)
$ kubectl apply -f https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/${LATEST}/kubevirt-operator.yaml
$ kubectl apply -f https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/${LATEST}/kubevirt-cr.yaml


Deployment From Source

By following these steps and best practices, you can ensure a smooth and successful KubeVirt implementation, providing a unified infrastructure management solution that leverages both virtual machines and containers.

Implementation Best Practices

Follow these best practices to get the most out of KubeVirt:

Conclusion

KubeVirt offers a compelling path for organizations seeking to reap the benefits of cloud-native technologies while maximizing the value of existing virtual machine investments. It boosts operational efficiency, fosters flexibility, and accelerates your modernization journey. 

 

 

 

 

Top