This is part 3 of a tutorial that demonstrates how to add OpenShift Virtualization 2.5 to an existing OpenShift 4.6 cluster and start a Fedora Linux VM inside that cluster.

Please refer to “Your First VM with OpenShift Virtualization Using the Web Console” for the introduction of this tutorial and for links to all of its parts, and refer to “Adding OpenShift Virtualization to Your OpenShift Cluster Using the Web Console” for part 2 of this tutorial.

Because this tutorial performs all actions using the OpenShift Web Console, you could follow it from any machine you use as a personal workstation, such as a Windows laptop. You do not require a shell prompt to type oc or kubectl commands.

You do not actually know that your installation of OpenShift Virtualization really works until you have a VM that is up and running. Before showing you how to create and start a virtual machine on OpenShift, this tutorial explains three prerequisite tasks:

1. Verifying how large a VM your cluster has capacity to run

2. Finding a small VM image, suitable for testing

3. Generating a SSH key pair to access your new VM

Check Memory Available on Your Nodes

It is a good idea to check how much memory you can realistically allocate for your VMs inside your cluster nodes. You may be surprised to find how much memory is already taken by cluster operators in a small test cluster.

Please rely on the written instructions more than on the screen captures. They are here mostly to provide you visual aid and assurance that you are on the correct page for each step.

Click Compute → Nodes to view the list of nodes of your cluster. Check the Memory column for your compute nodes (workers). It displays the used and total memory of each of them. Be aware that the total memory may be misleading because not all of it can be allocated to workflows. A small fraction of it, around 512GiB by default, is reserved for a node’s systemd services and static pods.

 

For master01, used memory is close to 7GiB, and a little more than 7GiB is available (discounting the reserved memory). I get similar numbers for master03 and master02 has about 10GiB available. It looks like I have sufficient capacity for one “standard” VM with 4GiB of memory per node, and I could even create one VM (and only one) with 8 GiB.

Please be aware that these numbers are not exact, and that they reflect the request capacity of active workloads, not the actual usage of memory and CPU. Each VM requests a bit more memory for its wrapper KVM container, and you do not want to request too close to 100% of the capacity of a node, to allow some room for applications with resource limits higher than their requests.

Finding a VM Image

The easiest way of creating a VM with OpenShift Virtualization is from a qcow2 VM image file available from an HTTP server. There are many of them available on the internet.

My choice is the Fedora 32 Cloud Base image for Openstack available at:
https://alt.fedoraproject.org/cloud/

Other alternative sources of qcow2 VM images to play with are:

If you have a web server available on your network that is accessible from your OpenShift cluster nodes, you can download the standard RHEL 8.2 qcow2 image from the Red Hat Customer Portal (https://access.redhat.com/downloads) and copy it to your web server.

Generating a SSH Key Pair

Most cloud-ready and OpenStack-ready qcow2 images are configured to allow only SSH key-based authentication, so if you do not have an SSH key pair, it is time to create one without a password.

Linux and Mac users would open a shell and use the ssh-keygen command. It saves the key pair in the id_rsa (private part) and id_rsa.pub (public part) files in your ~/.ssh folder unless you specify different file names.

If you have a GUI SSH client such as Putty, it should provide you a way of generating SSH key pairs, so you do not need a shell for that. Just be sure to know where the files are and which are the public and private parts. You need the public part to create a VM, and the private part to access it.

Next Steps

Now that you know how large your VMs can be, got a test qcow2 image, and created an SSH key pair, you can proceed to part 4 of this tutorial: “Creating a VM using the OpenShift Web Console.”


About the author

Fernando lives in Rio de Janeiro, Brazil, and works on Red Hat's certification training for OpenShift, containers, and DevOps.

Read full bio