Whether you are a new or a seasoned Kubernetes user, or you’re just considering working with Kubernetes, you have probably started exploring the technology and how best to integrate virtual machines with the Kubernetes engine. But which solution fits your needs? Is there a way to leverage both the isolation virtual machines provide and the orchestration platform of the Kubernetes engine? With Red Hat OpenShift, you can do both.
OpenShift 4.3 offers the ability to run both container-based workloads and virtual machines side by side as workloads on a Kubernetes cluster. Installing the Container-native virtualization operator on OpenShift will allow you to create, run, and manage VMs, as well as provide templates to quickly create the same VM multiple times.
(image form: https://www.openshift.com/)
But what is the virtualization experience in OpenShift? How advanced or simple are these virtual machines? Are they both highly customizable for the advanced user and easy to use for the novice user? Is it similar to virtual machines as we know them today? Enter Container-native virtualization.
OpenShift’s Container-native Virtualization (CNV) is Red Hat’s solution for running VMs on a Kubernetes cluster. CNV is set to achieve two goals: The first is to help all users consolidate their workload footprint to one platform, thus reducing the operational overhead of managing an additional virtualization platform alongside a container platform, whether they are long term virtual machines users or new to the VM world. The second is leveraging the Kubernetes engine’s and ecosystem strength and help users modernize their traditional workload capabilities, orchestration, and architecture.
CNV is a set of extensions to Kubernetes, designed to integrate seamlessly with other workloads. By doing so, you can now enjoy the best of both worlds, running virtual machines as you know them, but with the added benefit of all the features that Kubernetes offers.
Positioning Kubernetes at the center of running all sorts of workloads, the transition from VMs to Kubernetes is as simple as possible for users of any experience level.
In this post we will demonstrate how easy it is to manage virtual machines in OpenShift and take a look at the added benefits of the underlying Kubernetes technology.
We will start by breaking down the key features in the creation process. Let’s jump right in.
You have deployed an OpenShift cluster on bare-metal and installed the Container-native Virtualization operator that enables you to run virtual machines on it.
Introducing virtual machines on OpenShift
You can find the virtual machines section by navigating through the left side global navigation, under the ‘Workloads’ tab. A click on the ‘Virtual Machines’ menu item will land you on a virtual machines list on your cluster. Naturally, if this is your first time creating a virtual machine on this cluster, this list will be empty at this point.
Click on the ‘Create Virtual Machine’ primary button at the top of the list. This will bring you to our brand new VM creation wizard. This wizard is compiled from basic concepts that are required for any functioning virtual machine, as well as some more advanced features.
Create Virtual Machine wizard
Step 1: General
The first step, ‘General’ covers any basic info required to create a virtual machine. On completing this step, you can already skip everything else to the review before the creation step by clicking the ‘Review and Create’ button. This button is always available for you from this point forward.
Let’s break this step down.
Templates are a set of virtual machines configurations defined by the users. They may include all field predefined or leave some of them empty, they may also include Networking and Storage configurations, as well as other properties. You can choose to use one of them as is and create your virtual machine. You can use them as starting points, getting you closer to your desired configuration.
When a template has been modified the template field will reflect this by appending -modified to the template name.
If you are interested in starting a fresh configuration from scratch, select ‘None’.
Please note that some templates may include different configurations for the next steps on the wizard as well, while others may only affect this ‘General’ step.
In the source field you select the method of uploading or using the Operation System installation. There are four options to select from when providing a source for the VM:
PXE enables the user to install an OS and configure it over a network. PXE depends on DHCP to find the PXE Server on an L2 Network.
An external URL to the .iso, .img, .qcow2 or .raw that the virtual machine should be created from.
Ephemeral virtual machine disk image which will be pulled from a container registry. A container allows you to provide an image from a container registry.
This method requires specifically prepared containers, and not just any container.
Select an existing Persistent Volume Claim as a disk that has been previously cloned or created. When selecting “Attach Disk” the user will be prompted to select an available disk that has been previously cloned or created and made available as a Persistent Volume Claim.
Operating systems, Flavors, and Workload profiles
Selecting an operating system will fetch the relevant fields required, and available options for that OS. By doing this, the console will provide predefined resources request configurations called ‘workload profile’ and ‘Flavor’ suited for that OS which we will look into next.
Flavor is a CPU and Memory resources request, combined into five, off the shelf, sizes: Tiny, small, medium, large, custom.
While these flavor sizes differ in specicifaction from one operating system to another, they are aligned to the amount of resources required to run that OS and the profile user has selected.
By selecting custom, the user can request different CPU and Memory requests, as long as they do not exceed the clusters limit or go below the minimum required to run that OS.
The user can choose from three workload profiles: High-Performance, Server or Desktop.
Each of these profiles will provide a configuration better suited for the character of the workload which will be running on the requested VM.
Name and Description
This name will appear as the VM’s name and title of that VM’s page as well as any list that VM will appear on. The description will appear only on the VM’s overview page.
Step 2: Networking
The next step on the creation wizard is ‘Networking’. Upon entering this step you are introduced to an already existing Network interface (or NIC). You can select to customize this Network interface, add new ones, or remove any of them. In this step, the 'Review and Create' button is available to skip the rest of the steps.
Step 3: Storage
The third Step 'Storage' will show a list of disks included in the upcoming VM. Depending on the source you have selected in the first step this might be pre-populated with some or no disks.
The user can add, modify or remove a disk. Adding a disk could be either to create a new disk or attach an existing one.
Clicking the ‘Add disk’ button will pop up the disk modal and you will be able to choose the type of disk from the Source drop down menu:
Blank (default), URL, Container and Attach disk, Attach cloned disk.
Step 4: Advanced
The “Advanced” setting step of the create VM wizard introduces the ability to configure Cloud-Init. In future versions, additional options like virtual hardware and boot order will be included as well.
In this section you have two options to configure the "cloud-init" settings:
- By filling a form (default) to define a set of common parameters like hostname and authorized SSH keys.
- By providing a custom cloud-init script.
Step 5: Review
This last step is a summary of settings configured. Here, you may review and verify this configuration before creating this virtual machine.
From here all the previous steps are available to skip to either by skipping with the ‘Back’ button or by clicking their names on the left navigation.
A click "Create Virtual Machine" will set the creation VM progress in motion. Once the VM was created you will land on the “Results” page that lets you navigate to the details page or go to the list.
Container-native Virtualization adds the ability to easily create and manage traditional virtual machines inside of OpenShift alongside standard container workloads. Its deep integration into the OpenShift UI makes the first steps very easy and intuitive. Powered by Kubernetes engine, VMs have never been so well integrated with containers. You should try this hybrid deployment, see for yourself how easy it is.
Read more about
- OpenShift’s design repository
- Openshift’s Virtualization design repository
- OpenShift Tech Topic Container-native Virtualization
- Container-native Virtualization FAQs
- Kubevirt (Upstream of CNV)