Migrating to OpenShift VM can be a daunting task, but with the right guide, you'll be up and running in no time. OpenShift VM is a managed platform that provides a scalable and secure environment for your applications.
To start, it's essential to understand that OpenShift VM uses a containerized architecture, which allows for efficient resource utilization and improved application deployment. This architecture is based on Docker containers and Kubernetes orchestration.
When migrating to OpenShift VM, you'll need to consider the compatibility of your existing applications with the new platform. According to the compatibility matrix, most Java-based applications are compatible, but some may require additional configuration.
Installation and Configuration
To install OpenShift Virtualization, you'll need to log in to the OpenShift Management Console and go to OperatorHub, where you can search for the "OpenShift Virtualization" operator.
After installing the OpenShift Virtualization Operator, you'll need to create HyperConverged using the Local Storage Class Name to create and maintain OpenShift Virtualization Deployments.
You can check for the new "Virtualization" option under the Workload section once the installation is complete.
Install Operator
To install the necessary operators for OpenShift Virtualization, you'll need to start by logging in to the OpenShift Management Console and navigating to OperatorHub.
First, search for the "OpenShift Virtualization" operator and select it. Then, proceed with the installation, choosing the appropriate options as you go.
Once the installation is complete, you'll need to create a HyperConverged resource using the Local Storage Class Name. This will create and maintain the OpenShift Virtualization Deployments.
Next, you'll need to install and configure the OpenShift Data Foundation Operator for underlying storage. To do this, log in to OperatorHub and search for the "OpenShift Data Foundation" operator.
Select the operator and provide the necessary input values, then click Install.
After the installation is complete, create a Storage System, which will create a Storage Cluster. You'll need to provide an existing Storage class to provision the new storage.
The Storage System creation process will also install various storage components, including BackingStore, BucketClass, CephBlockPool, and more. Wait until all these components are in the Ready state.
Once the storage components are ready, you can verify that the storage class has been created. With these operators installed and configured, you're now ready to deploy a virtual machine on OpenShift.
Configure Operator for Underlying Storage
To configure the underlying storage for your VM deployments, you'll need to install the OpenShift Data Foundation (ODF) Operator. This operator will configure the storage for your VMs to use.
First, log in to your OpenShift Management Console and navigate to the OperatorHub. Search for the "OpenShift Data Foundation" operator and select it. Provide the required input values and click Install.
After installation, create a Storage System, which will create a Storage Cluster. You'll need to provide an existing Storage class to provision the new storage for Storage Cluster creation to proceed.
Once the Storage System creation is complete, the storage components such as BackingStore, BucketClass, CephBlockPool, etc. will be installed in the background. Wait for all the components to be in the Ready state.
After that, check that the storage class is created in the backend.
Now, you're ready to deploy a virtual machine on OpenShift.
Here are the steps to install and configure the ODF Operator:
- Login to OpenShift Management Console and go to the OperatorHub
- Search the Operator “OpenShift Data Foundation” operator
- Select the Operator and provide appropriate input values. Click on Install.
- Create a Storage System which would in turn create a Storage Cluster
- Provide an existing Storage class to provision the new storage for Storage Cluster creation to proceed
- Wait for all the components to be in the Ready state
- Check that the storage class is created in the backend
Configuring Custom Hook Execution for Backups
By default, Trilio runs custom hooks on each VM selected for backup to initiate freeze/quiesce and unfreeze/unquiesce operations, provided a QemuGuestAgent is connected.
These operations are critical for maintaining data integrity and preventing data corruption during the backup process.
Disabling custom hook execution is generally not recommended, as it may affect data consistency in the Virtual Machine backup.
To disable custom hook execution for a specific VM, add the following annotation to the VM resource:
Note that disabling custom hook execution is an option, but not the default behavior.
Reference Architecture
A reference architecture is a high-level overview of the system's components and how they interact with each other. This is crucial for the installation and configuration process.
The system is composed of three main layers: the presentation layer, the application layer, and the data layer. The presentation layer handles user input and output, while the application layer processes the data and the data layer stores it.
The presentation layer is built using the HTML5 and CSS3 technologies, which provide a robust and flexible framework for creating visually appealing and user-friendly interfaces. This is evident in the example of the login page, which uses HTML5 forms and CSS3 styles to create a seamless user experience.
The application layer is built using the Java Spring Boot framework, which provides a rapid development environment and a robust set of tools for building scalable and maintainable applications. This is demonstrated in the example of the user management module, which uses Java Spring Boot to handle user authentication and authorization.
The data layer is built using the MySQL database, which provides a robust and scalable storage solution for the system's data. This is evident in the example of the user data storage, which uses MySQL to store user information.
The system also uses a message queue to handle asynchronous tasks and communication between components. This is demonstrated in the example of the task scheduler, which uses a message queue to schedule tasks and notify components of their execution status.
About RunStrategies
RunStrategies provide a flexible way to manage virtual machine instances (VMIs) in OpenShift Virtualization clusters. A RunStrategy determines a VMI's behavior based on specific conditions.
There are four defined RunStrategies: Always, RerunOnFailure, Manual, and Halted. The Always RunStrategy creates a new VMI if the original stops for any reason.
The RerunOnFailure RunStrategy re-creates a VMI if the previous instance fails due to an error, but not if it stops successfully. This is the same behavior as setting spec.running to true.
The Manual RunStrategy leaves the VMI in its current state, unaffected by virtctl commands. This is the same behavior as setting spec.running to false.
The Halted RunStrategy is a special case where no VMI is present when a virtual machine is created. This is the same behavior as setting spec.running to false.
Here's a summary of how the virtctl commands affect the RunStrategy:
Backup and Recovery
To backup a Virtual Machine on OpenShift, you can use Trilio for Kubernetes, which treats Virtual Machine as any other object and application running on the platform.
Backup and recovery is a crucial process to maintain data integrity. Trilio runs custom hooks on each VM selected for backup to initiate freeze/quiesce and unfreeze/unquiesce operations, provided a QemuGuestAgent is connected.
These operations are critical for maintaining data consistency and preventing data corruption during the backup process. This default behavior is recommended to ensure consistent, reliable backups.
However, users have the option to disable these custom hooks if they do not wish to quiesce/unquiesce the VM filesystem during backups. Disabling custom hook execution is generally not recommended.
To disable custom hook execution for a specific VM, add the following annotation to the VM resource:
Overview and Benefits
Red Hat OpenShift Virtualization is a game-changer for organizations looking to run and deploy their virtual machine workloads. It's an included feature of Red Hat OpenShift, providing a modern platform for easy migration and management of traditional virtual machines.
With OpenShift Virtualization, you can preserve existing virtualization investments while embracing modern management principles. This means you can take advantage of the simplicity and speed of a cloud-native application platform.
KubeVirt is another alternative worth considering, as it allows virtual machines to run inside containers using native Kubernetes environment addon technology. This enables you to address VMs via the API, similar to native containerized workloads.
Migrating to OpenShift Virtualization can be done in both offline and online fashion, and it's actually quite easy. You can use tools like the Red Hat Migration Toolkit for Virtualisation (MTV) Operator to simplify the process.
Here are some key benefits of using OpenShift Virtualization:
- Easy migration of traditional virtual machines onto a cloud-native application platform
- Preservation of existing virtualization investments
- Embracing modern management principles
- Ability to run virtual machines alongside containers on the same Red Hat OpenShift nodes
Migration and Modernization
Red Hat OpenShift Virtualization includes a simple way to migrate VMs from other hypervisors with the included Migration Toolkit for Virtualization.
You can migrate VMs to the cloud, and even get hands-on support with your migration through Red Hat Services' mentor-based consulting.
A path to infrastructure modernization is available when you migrate VMs from other platforms and run them on Red Hat OpenShift.
This approach allows you to get the most from your existing virtualization investments while taking advantage of cloud-native architectures, streamlined operations and management, and new development approaches.
Red Hat OpenShift brings modern application development processes and tools to VMs to expedite the modernization of existing applications.
To migrate with confidence and modernize with control, you can use Red Hat OpenShift Virtualization alongside Red Hat's trusted products and partner ecosystem.
Here are the key steps to configure a successful migration:
- Providers: Detail the platform integrations, such as migrating from VMware, Red Hat RHV, Red Hat OpenStack, and other OpenShift platforms (Version 4.x only).
- Plans: Create a migration plan to detail source and destination platforms and options.
- NetworkMaps: Detail how to address the networking translation, such as VM Network to OpenShift network layers.
- StorageMap: Map individual ESXi data stores to the cluster CSI storage classes.
Red Hat OpenShift is a consistent and efficient platform for both traditional and next-generation applications, allowing you to safeguard your existing VM investments while migrating to the cloud.
Frequently Asked Questions
Can I run VM on OpenShift?
Yes, you can run virtual machines (VMs) on OpenShift, allowing for a hybrid environment with both containers and VMs on the same platform. Learn how to create, deploy, and migrate VMs on OpenShift.
What is OpenShift virtualization?
OpenShift Virtualization is a feature that allows you to run and manage virtual machines alongside container workloads in your OpenShift cluster. It uses Kubernetes custom resources to enable virtualization tasks, making it easy to integrate with your existing container environment.
Sources
- https://docs.trilio.io/kubernetes/appendix/backup-and-restore-virtual-machine-running-on-openshift-virtualization
- https://www.redhat.com/en/technologies/cloud-computing/openshift/virtualization
- https://www.wwt.com/briefing/introduction-to-openshift-virtualization-for-the-vmware-sme
- https://veeamkasten.dev/ocpv-migration
- https://docs.openshift.com/container-platform/4.8/virt/virtual_machines/virt-create-vms.html
Featured Images: pexels.com