Deploying OpenShift Virtualization on Red Hat OpenShift on AWS (ROSA)
In today’s rapidly evolving cloud landscape, containerization and virtualization are key components for building scalable and efficient infrastructure. Red Hat’s OpenShift Virtualization, an extension of the popular OpenShift Container Platform, combines the benefits of Kubernetes orchestration with traditional virtualization. In this article, we’ll walk you through the process of deploying OpenShift Virtualization on Red Hat OpenShift on AWS (ROSA).
Prerequisites
Before we get started, ensure that you have the following prerequisites in place:
- Red Hat OpenShift on AWS (ROSA) cluster up and running.
- Familiarity with Git and OpenShift.
- AWS Credentials to be used for the AWS Load Balancer Operator.
Reference Repositories
To facilitate the deployment process, we’ll be using two GitHub repositories:
1. sno-quickstarts: This repository contains quickstart scripts and configurations for Red Hat OpenShift.
2. kubevirt-gitops: This repository includes configurations for deploying OpenShift Virtualization (KubeVirt) on OpenShift.
Configure baremetal instances in your Rosa Enviornment.
This will allow you to run virtual machines on top of the bare-metal instances. In this example, we are using the m5d.metal instance. A machine pool was added with a minimum of two instances and an autoscale of three.
Configure Your Rosa Environment to support OpenShift
Add odf-nodes to your OpenShift Cluster this will allow you to have support for live migration. OpenShift Data Foundation nodes are specialized worker nodes dedicated to running OpenShift Data Foundation (ODF). ODF itself is a suite of storage and data services that integrates seamlessly with OpenShift, offering persistent storage for your containerized applications.
Ensure the ODF nodes are labeled correctly with the label
oc label node node-name.cluster.ocs.openshift.io/openshift-storage=””
Update your Rosa Cluster to the latest version as of this article it is 4.13.
Let’s dive into the deployment steps.
Deploy OpenShift GitOps
We’ll start by deploying OpenShift GitOps, which is based on the OpenSource project ArgoCD. Execute the following commands:
git clone https://github.com/tosin2013/sno-quickstarts.git
cd sno-quickstarts/gitops
./deploy.sh
cd $HOME
Apply OpenShift YAML to Argo Cluster
Next, apply the OpenShift YAML configurations to your Argo CD cluster:
cd $HOME
git clone https://github.com/tosin2013/kubevirt-gitops.git
cd kubevirt-gitops
git checkout rosa
oc apply -f apps/openshift.yaml
Ensure that all components are healthy in the Argo CD dashboard.
Deploying VMs
Once the httpd container is deployed, you can start provisioning virtual machines. To do this, you’ll need to copy an ISO file to the httpd container. Here’s how:
1. Download a Windows Server 2019 ISO from this link.
2. Copy the ISO file to your home directory and then execute the following commands to copy it to the httpd container:
3. Optionally rename the Windows iso to win2k19.iso if you make the change you must also change the install-iso.yaml on line 19.
ISO_FILE=$HOME/win2k19.iso
POD_NAME=$(oc get pods - selector=app=httpd-server -o jsonpath='{.items[0].metadata.name}')
oc -v cp $HOME/win2k19.iso $POD_NAME:/opt/app-root/src
Running VMs
You can now run VMs on your OpenShift Virtualization platform. In the provided screenshots, you can see CentOS Streams 8 and Windows Server 2019 VMs in action.
Additionally, there’s a Fedora Server VM also available in the GitOps instance.
VMs Tile
The VMs tile within the OpenShift Virtualization platform contains Fedora and CentOS VMs deployed using GitOps configurations.
Win2k19 Tile
The Win2k19 tile contains a Windows Server 2019 VM that is pre-configured with Sysprep.
Configure AWS Load Balancer Operator on ROSA for External Networking
To enable external networking for your virtual machines, you can configure the AWS Load Balancer Operator. Run the following command:
$ oc apply -k https://github.com/tosin2013/sno-quickstarts/gitops/cluster-config/aws-load-balancer-operator-on-rosa/operator/overlays
Deploy the AWS Load Balancer Instance
Once you’ve configured the AWS Load Balancer Operator, deploy the AWS Load Balancer instance using the following command:
$ oc apply -k https://github.com/tosin2013/sno-quickstarts/gitops/cluster-config/aws-load-balancer-operator-on-rosa/instance/overlays
After deploying the instance, you’ll be able to configure external access to your virtual machines.
RDP Configuration
To access your Windows Server 2019 VM, you need to configure RDP (Remote Desktop Protocol) settings. Create the RDP service using the following command:
vim rdp-endpoint.yaml
Replace the service configuration with the following:
apiVersion: v1
kind: Service
metadata:
name: rdp-endpoint
namespace: kubevirt-gitops
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: external
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: instance
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
spec:
ports:
- port: 3389
targetPort: 3389
protocol: TCP
type: LoadBalancer
selector:
kubevirt.io/domain: windows-install
vm.kubevirt.io/name: windows-install
workload.template.kubevirt.io/server: 'true'
Create the Service
oc create -f rdp-endpoint.yaml
You can now use an RDP client to connect to your Windows Server 2019 VM for testing and management.
Congratulations! You have successfully deployed OpenShift Virtualization on Red Hat OpenShift on AWS (ROSA) and configured external networking for your virtual machines. This setup provides a powerful environment for running and managing virtualized workloads within an OpenShift-based platform.
Reference Links:
- https://cloud.redhat.com/experts/rosa/aws-load-balancer-operator/
- https://cloud.redhat.com/blog/openshift-virtualization-4.14-cloud-deployment-options-expanded-security-and-more
- https://cloud.redhat.com/blog/managing-virtual-machines-and-containers-as-code-with-openshift-virtualization-on-red-hat-openshift-service-on-aws