Subscribe to our blog

Did you know that you can run virtual machines on OpenShift? OpenShift Virtualization is an operator that allows you to do just that. Once the operator is installed, you can run your VMs on OpenShift, side-by-side with your containerized workloads.

OpenShift Virtualization uses KVM, the virtualization software stack that is used in Red Hat Virtualization (RHV), in OpenStack, and in most clouds worldwide, to run the VMs that are managed by OpenShift just like any other workload in the cluster. And just like any other cloud native resource, VMs are also defined and managed as a code. This means that cloud native methodologies and tools that are used with containerized workloads can be applied to VMs as well.


What Is Tekton?

Tekton is a powerful and flexible open-source framework for creating CI/CD systems, allowing developers to build, test, and deploy across cloud providers and on-premise systems.

A Tekton pipeline is a collection of tasks that you define and arrange in a specific order of execution as part of your continuous integration flow. Each task in a pipeline executes as a pod on your Kubernetes cluster. You can configure various execution conditions to fit your needs.

OpenShift pipelines uses Tekton building blocks to automate deployments across multiple platforms. In this blog I will refer to Tekton, but for production environments, OpenShift pipelines is recommended.

Creating and Customizing the OS Installations

Tekton pipelines can control many VM tasks, from a single VM operation to managing the VM's entire life cycle. It can run tasks like downloading a Windows OS image, customizing VM configuration, deploying the VM, and more. This creates VMs that are consistent and that minimize human errors and increase security.

An example of a common process that can be used is Windows OS installation, where a pipeline can manage the unattended sysprep process. You can create a Kubernetes config file that holds the sysprep files (autounattend.xml, etc.) and define a pipeline that provisions a new Windows VM, attaches the config file, and starts the VM. This will trigger the Windows automated unattended installation.

You can think of many other tasks and build your own pipelines. Start by creating multiple Tekton tasks for many of VM operations. Once those stages are ready, use them as building blocks to build Tekton pipelines that can automate the processes you need.

AI/ML and Other Use Cases

Tekton pipelines can include a single task or a few tasks to perform specific operations like customizing VM disks or networks. In more complex operations, a pipeline can include multiple tasks that control the entire VM lifecycle, from creation to termination and deletion.

An interesting use case for a full lifecycle management are AI/ML workloads that may require VMs for things like AI/ML visualization. These VMs can be fully provisioned and managed by Tekton pipelines, from image preparation, attaching a data source, starting the VM that runs the ML module, and once done, shutting down the VM (and in some cases, deleting it). Repeat this pipeline with a new data source as many times as needed.

Summary

With OpenShift Virtualization, VMs are cloud native objects that are declared as code. They share the same API as containers and can be treated just like a container workload. This means that CI/CD processes can include a mix of VMs and containers, and Tekton can run tasks on VMs and containers in a single pipeline, sequentially or in parallel, avoiding silos and eliminating multi-system dependencies.

Tekton (and OpenShift pipelines) is a Kubernetes-native CI/CD framework that can be used with many other CI/CD products to perform a variety of tasks. OpenShift Virtualization brings virtual machines into OpenShift so they are managed with the same API as containers. Because of that, VMs can be managed seamlessly by Kubernetes-native tools like Tekton and ArgoCD alongside containerized workloads. Automating VM-related tasks with Tekton is safer, repeatable, and faster than performing them manually. Those Tekton tasks and pipelines can be shared across clusters for cross-cluster consistency.

You can find some examples of Tekton Tasks for virtual machines in the OpenShift documentation here or in this GitHub repository.

Existing VMs can “lift and shift” to OpenShift Virtualization using tools like Red Hat Migration Toolkit for Virtualization (MTV) and benefit from these same capabilities without the need to rewrite them.

Whether you’re already using Tekton or are new to it, I hope this post gave you some ideas on how to use VMs in pipelines. I’m sure you’ll be able to find additional use cases once you start using it.


About the author

Browse by channel

automation icon

Automation

The latest on IT automation for tech, teams, and environments

AI icon

Artificial intelligence

Updates on the platforms that free customers to run AI workloads anywhere

open hybrid cloud icon

Open hybrid cloud

Explore how we build a more flexible future with hybrid cloud

security icon

Security

The latest on how we reduce risks across environments and technologies

edge icon

Edge computing

Updates on the platforms that simplify operations at the edge

Infrastructure icon

Infrastructure

The latest on the world’s leading enterprise Linux platform

application development icon

Applications

Inside our solutions to the toughest application challenges

Original series icon

Original shows

Entertaining stories from the makers and leaders in enterprise tech