Your resource for web content, online publishing
and the distribution of digital products.
S M T W T F S
 
 
 
 
 
1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
 
28
 
29
 
30
 

OpenShift Virtualization: Unify, Manage and Scale Hybrid Cloud

DATE POSTED:August 27, 2024

Virtualization has been a cornerstone of modern IT infrastructure for decades, but the rise of cloud-native technologies and containerization has exposed limitations in traditional virtualization approaches. IT teams find themselves juggling separate management tools and workflows for virtual machines (VMs) and containers, leading to inefficiencies and increased complexity.

\ OpenShift, with its integrated virtualization capabilities powered by KubeVirt, bridges this gap by enabling the unified management of both virtual machines (VMs) and containers within the same OpenShift environment. This article covers the core concepts of Openshift Virtualization, explores its advantages, and examines how it allows organizations to improve their operations and modernize IT infrastructure.

Understanding Virtualization Options

Modern virtualization has different forms, each addressing specific requirements and use cases. Let's explore the primary options: traditional, cloud-based, and OpenShift virtualization.

Traditional Virtualization

Virtualization has transformed how we use computing resources. At its core, virtualization involves software known as a hypervisor that creates an abstraction layer on top of physical hardware. This allows running multiple, isolated virtual machines on a single physical server. Each VM simulates its own dedicated set of hardware—CPU, memory, disk, and network—and runs a complete operating system and applications on it.

\ Traditional virtualization has delivered benefits like server consolidation, increased hardware utilization, improved workload isolation, and enhanced disaster recovery. Popular hypervisors include VMware vSphere, Microsoft Hyper-V, and KVM (Kernel-based Virtual Machine).

Cloud-based Virtualization

Cloud-based virtualization takes the concept further by using the resources of cloud providers. Infrastructure as a service (IaaS) offers virtualized compute instances on demand. With cloud-based virtualization, you benefit from rapid scaling and a pay-as-you-go model, eliminating the need for hardware maintenance and providing the flexibility to deploy workloads across different geographic locations. Key examples include AWS EC2, Azure Virtual Machines, and Google Compute Engine.

OpenShift Virtualization

OpenShift Virtualization is a feature built into OpenShift that seamlessly integrates virtual machine management with containerized workloads. Built upon KubeVirt, it extends the container orchestration capabilities of Kubernetes to manage the lifecycles of virtual machines.

\ The emphasis here is on integration: OpenShift Virtualization provides a unified platform to manage both VMs and containers side by side. This translates into reduced complexity, streamlined management using familiar Kubernetes tools, the potential to modernize legacy applications, and the opportunity to use your existing Kubernetes expertise.

The Advantages of OpenShift Virtualization

OpenShift Virtualization's integration with Kubernetes unlocks a range of compelling benefits that address specific IT challenges.

Efficiency
  • Consolidated Management: OpenShift Virtualization provides a single, unified platform to manage both VMs and containers. IT teams no longer need to switch between different tools and interfaces, simplifying operations and reducing overhead.
  • Improved Resource Utilization: By combining container and VM workloads within OpenShift, you can optimize resource usage across your infrastructure. This allows for higher workload density and a more efficient use of your hardware.
Scalability
  • Seamless Scaling: OpenShift Virtualization uses the inherent scaling capabilities of Kubernetes. VM workloads can be scaled up or down with the same ease as containerized applications, ensuring that your infrastructure is responsive to dynamic business demands.
  • Diverse Workloads: OpenShift's flexibility allows you to accommodate a wide spectrum of workloads, both legacy and cloud-native. You can run traditional VM-based apps alongside cutting-edge containerized microservices, providing a smooth transition path to modern architectures.
Security
  • Kubernetes Security Model: OpenShift Virtualization benefits from the robust security mechanisms built into Kubernetes, including role-based access control (RBAC), network segmentation policies, and secure image management.
  • Granular Isolation: VMs can be isolated with fine-grained controls, ensuring the security of sensitive workloads. This allows for compliance with various industry regulations and security standards.
Configuring a VM Deployment in OpenShift Virtualization

Let's illustrate the main concepts of OpenShift Virtualization with a hands-on example. We'll walk through the process of deploying a simple virtual machine using a YAML configuration and  kubectl  commands.

\

:::info Note: This is a simplified example. More complex VM configurations might involve multiple disks, advanced networking, or integration with  cloud-init  for customization.

:::

\ Prerequisites:

  • A running OpenShift cluster with OpenShift Virtualization enabled.
  • Access to the  kubectl  command-line tool.
1. Creating the VM Definition (YAML)

Here's a detailed YAML example for creating a virtual machine using specific OpenShift Virtualization features and data sources. This example includes the configuration for a VM that uses a Red Hat Enterprise Linux 9 image from a pre-configured data source in OpenShift:

apiVersion: kubevirt.io/v1 kind: VirtualMachine metadata: labels: app: name: spec: dataVolumeTemplates: - apiVersion: cdi.kubevirt.io/v1beta1 kind: DataVolume metadata: name: spec: sourceRef: kind: DataSource name: rhel9 namespace: openshift-virtualization-os-images storage: resources: requests: storage: 30Gi running: false template: metadata: labels: kubevirt.io/domain: spec: domain: cpu: cores: 1 sockets: 2 threads: 1 devices: disks: - disk: bus: virtio name: rootdisk - disk: bus: virtio name: cloudinitdisk interfaces: - masquerade: {} name: default rng: {} features: smm: enabled: true firmware: bootloader: efi: {} resources: requests: memory: 8Gi evictionStrategy: LiveMigrate networks: - name: default pod: {} volumes: - dataVolume: name: name: rootdisk - cloudInitNoCloud: userData: |- #cloud-config user: cloud-user password: '' chpasswd: { expire: False } name: cloudinitdisk

\ Explanation of key parameters:

  • dataVolumeTemplates: Specifies a data volume template using a RHEL 9 image from the OpenShift Virtualization OS images namespace.
  • evictionStrategy: Set to LiveMigrate to allow for live migration of the VM under certain conditions.
  • cloudInitNoCloud: Uses cloud-init to configure the VM upon first boot with specified user credentials.
2. Deploying the VM using OpenShift CLI

Deploy the VM by applying the YAML file with the OpenShift command-line interface:

$ oc create -f .yaml 3. Starting the VM

After the VM definition is successfully created, you can start the VM using virtctl, a command-line tool specifically designed for managing virtual machines in environments that use KubeVirt:

$ virtctl start

\n This sequence allows you to create and start a virtual machine in OpenShift Virtualization, leveraging specific configurations and OpenShift's virtualization capabilities. Adjust , , and .yaml with actual values before running the commands.

4. Accessing the VM

Accessing the virtual machine can vary based on its operating system and network configuration. Here are several methods provided by OpenShift to access VMs:

  1. Web-based VNC Console: OpenShift Virtualization provides a built-in VNC console accessible through the web-based OpenShift console. This allows you to interact with the VM’s graphical interface directly from your browser.

    \

  2. SSH: If the VM has SSH configured and is on a reachable network, you can connect using an SSH client. This requires network access to the VM and appropriate SSH credentials.

    \

  3. Serial Console: OpenShift allows access to a VM's serial console via the OpenShift console. This can be particularly useful for troubleshooting issues when SSH or VNC may not be available.

    \

  4. Virtctl Tool: Using the virtctl command-line tool, you can access the graphical or serial console of a VM. This method is handy for users who prefer command-line tools or need to automate console access.

\ The typical commands are:

virtctl vnc

\ for VNC access, or

virtctl console

for serial console access.

\

  1. SPICE (Simple Protocol for Independent Computing Environments): If your setup includes the SPICE protocol, it offers a high-quality graphical experience for interacting with VMs. SPICE access usually requires additional client software.

Each of these access methods might require specific configurations on the VM or within the OpenShift environment to function correctly. Ensure that necessary roles and permissions are set to allow users to access VM consoles according to your organizational security policies. Always check the current OpenShift documentation for updates or changes to these processes, as tools and methods may evolve with new OpenShift versions.

Real-World Use Cases for OpenShift Virtualization

OpenShift Virtualization's versatility makes it an excellent choice for a variety of scenarios. Let's look at some common use cases.

Application Modernization

OpenShift offers a path to modernize legacy applications without requiring full-scale rearchitecting. You can “lift and shift" existing VM-based applications to OpenShift, gradually breaking them down into microservices while maintaining functionality. Applications that help with OpenShift backup and restore enhance this modernization process with robust backup and recovery capabilities for VMs, minimizing the risk of data loss or downtime during the transition and reducing the costs associated with modernization initiatives.

Hybrid Cloud Architectures

For organizations spanning on-premises and cloud environments, OpenShift creates a common management layer for diverse infrastructure. OpenShift Virtualization lets you deploy and manage VM-based workloads consistently across both cloud and on-prem data centers, allowing for a seamless hybrid cloud experience.

Development and Testing

OpenShift Virtualization helps you rapidly set up complex development and testing environments that include both traditional VMs and containers. This ability to mimic production-like environments with VMs accelerates software delivery cycles and helps uncover potential issues earlier. And if something goes wrong, backup tools can help with point-in-time, application-consistent backups for virtual machines running within OpenShift Virtualization. This ensures that the entire VM state, including configuration, data, and any dependencies are preserved for rapid recovery.

Strategic Deployment of Standalone VM Clusters

Increasingly, organizations are exploring the strategic deployment of standalone clusters specifically for running VMs within OpenShift Virtualization. This trend is partly driven by Red Hat’s positioning of OpenShift Virtualization as a viable alternative to traditional virtualization platforms like VMware. By separating VM workloads into dedicated clusters, companies can optimize performance and management for these environments. Such a strategy not only enhances operational efficiency but also aligns with modern IT demands for specialized infrastructure solutions. Feedback from early adopters suggests that separate clusters for VMs and containers can lead to more tailored, effective management and scaling of resources according to specific workload requirements.