This is part one in a series about Openshift Virtualization with Portworx. The series will cover installation and usage, backup and restore, and data protection for virtual machines on Openshift.
Enterprises are increasingly moving applications to containers, but many teams also have a huge investment in applications that run virtual machines (VMs). Many of these VMs often provide services to new and existing containerized applications as organizations break the monolith into microservices. Enterprises are diving head first into their container platforms, which often provide a seamless integration of computing, storage, networking, and security. Portworx often provides the data management and protection layer for these containerized applications. OpenShift Virtualization uses KubeVirt to offer a way for teams to run their VM-based applications side by side with their containerized apps as teams and applications grow and mature. This provides a single pane of glass for developers and operations alike. In this blog series, we’ll show you how Portworx can provide the data management layer for containers and for VMs. You can think of Portworx much like the v-suite of products in vSphere. Portworx can provide disks to VMs like vSAN, and data protection like vMotion but for both VMs and containers on OpenShift Container Platform.
Install and Configure Portworx for Openshift Virtualization
In part one, we will focus on the installation and configuration of both Portworx and Openshift so that Portworx can provide disks for virtual machines to consume and use as both boot source and application persistence.
Install OpenShift using a version that supports virtualization, such as 4.5. Make sure all the OpenShift requirements are met. This includes tasks such as using a specific OS and sizing your worker nodes to ensure VMs can run properly.
After CDI is finished importing the image, create a VM using the virtual machine wizard. Make sure and select Disk as the Source and then attach the above disk in the Storage section.
Then choose this Portworx disk as your boot source. This will instruct the VM to boot off of this disk that has Fedora loaded into it.
Create the VM and verify it is up and running.
Next, log in to the VM. This can be done through the UI or by using virtctl.
You’ll see that Portworx is providing the VM’s root disk by issuing a df -h command. Confirm it is the same size (20GB) as the original PVC that used CDI to import Fedora.
Using cloud-init to run MySQL on PWX Volume on Fedora 31
In this example, we will attach a disk to our VM, but we won’t use it as our boot disk. Instead, we will launch the VM and manually add a filesystem, mounting the volume so it can be used by our application running inside the VM.
First, set up a storage class that will be used for your root disk.
Inside the virtual machine wizard, select the PVC created above in the Storage section to make sure it is attached to the VM when it is created.
Attach a Portworx PVC to the VM, but do not make it your boot source; this will just be a space for us to use for MySQL.
Next, use a cloud-init configuration that will create a filesystem on the Portworx disk and mount it to the /var/lib/mysql directory. Then have cloud-init enable MySQL repositories and install and start MySQL.
Next, follow the prompts in the VM wizard and create the VM. You can use the OpenShift web console or the oc command line to view the VMs that are running.
$ oc get vmi -n openshift-cnv
NAME AGE PHASE IP NODENAM
pwx-demo 3m11s Running 10.130.2.20 node03.demoocp.portworx.dev
$ oc get vm -n openshift-cnv
NAME AGE VOLUME
Login into the VM console using virtctl and see if MySQL is up and running by running the command systemctl status mysqld.
To visualize data flowing to the Portworx volume, we can install sysbench and run a simple performance benchmark. We also have Portworx monitoring with Prometheus installed so we can visualize application IO going to our Portworx volume.