Having Your Own OpenShift (2/3)

Weng Kee Teh
7 min readMay 11, 2023

Installing OpenShift on VirtualBox

Disclaimer: This is based on OpenShift version 4.12 and VirtualBox 7.0.8. As technology is advancing rapidly, just like everything else in life, your miles might be varied.

In my previous blog post, I set up a DNS service running on my Raspberry Pi 2. Next, we will look into setting up a virtual machine on VirtualBox.

Set up Virtual Box

In theory, you can opt to set up the virtual machine on any provider that you prefer, but my choice here would be Oracle VirtualBox on my Windows desktop PC — simple and it works.

Let’s get started. In VirtualBox, create a new virtual machine. I will leave the ISO image blank now as we will generate the discovery image later. The important thing here is to change the type to Linux and the version should be 64-bit.

Here, I change the slider to set the memory to 20 GB and 8 CPU, slightly more than enough for my SNO (Single Node OpenShift) according to the minimum specifications.

m

Setting the storage to 120 GB, I am leaving the pre-allocation disabled as I want it to be dynamically provisioned. 120 GB is again, the minimum required by SNO. I can always add more hard disks and provision separate PV (Persistent Volume) for workloads later.

After finishing going through the new machine adding wizard, I still need to change a few things in the virtual machine.

Here under Settings > System, I disabled it and move it down the boot order, and bump up the order of booting from Optical — we will need this later. Not sure why we still can choose to boot from a floppy disk, I wonder if the younger generations know what it is…

In the Network setting, I change the default network adapter to Bridged Adapter. With this, it will get its own IP from my local network and have access to the internet. I have copied the MAC address of this network interface, we will need this later.

Assisted Installer

I am amazed at how much OpenShift has evolved since I first get to use it. The installation has become very straightforward and the Assisted Installer has done a great job to do all the heavy lifting. We can access the installer by going to console.redhat.com — the Red Hat Hybrid Cloud Console. This is a centralized and consolidated place where you can analyze and manage your Red Hat environment. Here, I open this page on my PC desktop.

From Manage Infrastructure > OpenShift > Create Cluster > Data Center > Create Cluster, it leads us to an interface where we can enter details that will help us to create our own cluster.

Here:

  • I use sno as my cluster name
  • wengkee.home as my base domain — the same as what I have set up in my DNS in my previous blog.
  • The installer will pick the latest OpenShift version for us.
  • As my PC desktop is a 64-bit machine, I will pick X86_64.
  • Obviously, I am trying to install an SNO, so I will go ahead to tick that option.
  • I want to fix the IP of the SNO, so let’s do Static IP. Next!

OK, networking, the bori… I mean exciting stuff. We will only see this page if we pick static IP earlier.

  • IPv4, is self-explanatory.
  • For DNS, I will point it to the IP of my Raspberry Pi, which is hosting my DNS.
  • I put my LAN IP range in the Machine Network and Default Gateway section. Typically, this would default to 192.168.1.* range, but out of preference I have changed my LAN to 10.10.10.* range.

Here, I put in the MAC Address of the bridged network interface of the virtual machine that I set up earlier. The IP address is the same as what I have configured in my DNS.

For now, I am not using any of these services, so I will not check any of these, and next.

Almost there, just hand in there. Here, click on Add Host under Host discovery

  • Keep the provisioning type using the full image file.
  • Under SSH public key, this would be the public key that you can use to remote SSH into the SNO node itself, the underlying infrastructure of OpenShift. In normal situations, you should not need to do this. But in absolute last resort, this is probably the way. Here, I will put in the public key that I am using on my PC desktop.
  • I leave the rest as it is and click on Generate Discovery ISO.
I used wget in GitBash to download it

Next, we will be presented with a few options that we can use to download the generated ISO. Personally, I prefer to use wget as it is the most stable option. For some reason, the browser download option is really finicky for me… With wget, it took around 10–15 minutes to download for me, probably a good time to make a coffee.

Mounting the Discovery ISO

Once the download is complete, it’s time to go back to my virtual machine.

Here, I am mounting the discovery ISO in the optical drive. If you still remember, I have already configured the virtual machine to boot from this optical drive first earlier. So, let’s turn it on!

Install!

Switching back to Assisted Installer console, where I left off earlier.

I give it a few minutes, and sure enough, my virtual machine appears in the host inventory! I don’t really like how the hostname looks, which is resembling the MAC address and looks really gibberish to me, so I go ahead and change it to sno.

Next, I did not change anything in storage. As you can see, the hostname is changed.

Same here, nothing is changed.

One last look, check everything is good, and…. hit the Create button.

The installer will start to do its magic. There is nothing much to do here except click on the status and check the logs. So now it’s a good time to drink the coffee you made earlier…

Change booting order

At one point, the installer will stop and you will see it says Pending user action. Here, what it means is that the OS installation is completed and I no longer need to boot from the discovery ISO that I mounted earlier, it should boot from the hard disk.

So I go back to my virtual machine and changed the booting order, and restart the machine.

Last Stretch!

Go back to the Assisted Installer console, and wait. More coffee time… After 5–10 minutes, the installation will resume itself and the progress bar start moving again. And the option to download the kubeconfig file will appear. Download this file and keep it safe, we might need this.

Almost there, the control plane is ready, and my SNO web console URL is ready to be accessed! Notice that below the web console URL, is my kubeadmin username and password to log in to the web console.

Finally. Let’s take a look at the SNO! Click on the web console URL. As it is using a self-signed certificate, it will prompt a warning to proceed. Proceed ahead. Enter the kubeadmin username and password that voila!

And I have my own (Single Node) OpenShift cluster.

So, you may have this question. So what?

Next time, we will look at how to further configure this cluster and how can we use this cluster to host some simple web applications. Stay tuned!

References:

https://console.redhat.com

https://medium.com/@wengkee/having-your-own-openshift-b9357905f7eb

https://en.wikipedia.org/wiki/Private_network

--

--

Weng Kee Teh

A builder, a gamer, an explorer. Disclaimer: the views expressed here are those of the author, and do not reflect the views of his employer