Having Your Own OpenShift (1/3)

Weng Kee Teh
4 min readMay 6, 2023

Setting up DNS

Once upon a time…

I still remember my first few months joining Red Hat. It was exciting, I can’t wait to explore the new technologies and the new way of working. After having a couple of training, I realized I need more solid hands-on to really experience it myself. My M1 work laptop, running on ARM64 chipset is unfortunately not supported by the OpenShift (it soon will be!). I asked around and I found out that one of my peers manage to set up his home labs merely using his PC desktop. I have a lightbulb moment. I totally forgot that my PC a.k.a gaming rig is also capable of 1 more thing, to host a single node OpenShift cluster.

Upgrading desktop

My 4-year-old PC, which is a custom-built desktop, housing a Ryzen 5 2600, 6 cores CPU, capable of running 12 threads, fulfilled the minimum specs of running a Single Node OpenShift (SNO). Great, but I have only 16GB of RAM and it will not be sufficient for me to run OpenShift together with all my other stuff on Windows. Taking full advantage of this opportunity, it is time for adding a few more sticks to the motherboard — a few more extra RAM wouldn’t hurt for gaming :)

RGB is totally not necessary but it’s mandatory for mental happiness :)

Having 2 X 8GB RAM, I choose to add 2 more 16 GB RAM sticks of the same frequencies, resulting in 48GB RAM capable of running a pretty OK OpenShift cluster. The difference in the capacity of RAM does trigger my OCD, but it will do for now…

“Architecture”

My plan is to install SNO on a virtual machine, accessible by any device on my local network. I do not want to configure DNS on all my machines, so what is better than my old trustworthy Raspberry Pi 2 to do this simple job? Low powered, small form size, cute looking. No, but it’s just my excuse to put it to good use rather than collecting dust.

Installing DNSMasq on Raspberry Pi

My old yet durable Raspberry Pi 2

After plugging in the micro USB cable, SSH into the Pi, issue a command, and DNSMasq is installed. Fast and easy. Every time I power on the Pi, it will start DNSMasq service by itself.

sudo apt install dnsmasq

A few basic commands here

# check status
sudo systemctl status dnsmasq

# restart dnsmasq service
sudo systemctl restart dnsmasq
checking DNSMasq status

Cool! But just having a DNS service running is not enough, I need to configure it (of course…).

sudo vi /etc/dnsmasq.conf
# request to this domain only answered by local
local=/home/

# upstream DNS server
server=8.8.8.8
server=8.8.4.4

cache-size=1000

# stop resolving at upstream
# stop looking resolve.conf for changes
# and forward the request to specified DNS
no-resolv
no-poll

# stop reverse lookups for private ip to go to internet
bogus-priv

# stop request without domain
# unless specified in /etc/hosts or addn-hosts
domain-needed

###########################################
# Single Node OpenShift
###########################################
address=/apps.sno.wengkee.home/10.10.10.228
address=/api.sno.wengkee.home/10.10.10.228
address=/api-int.sno.wengkee.home/10.10.10.228

The important part of the configuration is the address mapping to the SNO. I use wengkee.home as the base domain, and sno as the cluster name, which the most experienced network expert might disagree with, but it’s not like this will run and host a few thousand transactions per second web server. Here, I have put in the 3 mapping rules that are listed as required in the OpenShift manual, with the URL being mapped to the private IP address that I planned to use later on.

After putting in the configuration, restart DNSMasq service so that the new configs will take effect.

Pointing My Router to Raspberry Pi for DNS Lookup

Next, I want all my devices to look up DNS using the DNSmasq service that I have just set up. While I can configure the DNS setting separately on all my machines, the easiest way to do this is really to just change it in my router. In the DHCP setting of my router, I set the primary DNS to point to the IP address of my Raspberry Pi, which in turn points to the DNSMasq service running on it. That’s it.

Next time, we will look into how I set up the virtual machine that would house the Single Node OpenShift.

References:

https://docs.openshift.com/container-platform/4.12/installing/installing_sno/install-sno-preparing-to-install-sno.html#install-sno-requirements-for-installing-on-a-single-node_install-sno-preparing

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