Installation Series — Article 3

Installing Kubernetes — OpenShift

Ayman Abu Qutriyah
Kubernetes DeveOps
Published in
6 min readAug 11, 2023

--

Red Hat OpenShift installation options and a demo

OpenShift && Kubernetes Container Platform

I delayed this installation topic for this powerful Kubernetes distribution for the various options available to install OpenShift; in this article, we will go through the multiple options and multiple versions of OpenShift available for testing and production environment.

Before we dive into details of how-to and installation details, it is worth mentioning the current offering of OpenShif from Red Hat:

Cloud Services Edition: this is provided on the major public cloud providers “AWS, Azure, IBM, and Google”; in this case, you won't need to care about installing and managing the OpenShift platform as the cloud provider or RedHat manages it.

Self-Managed: RedHat offers Red Hat OpenShift Platform Plus, which can be installed on-premise or on the cloud, and we, as SRE or DevOps engineers, have to install and manage it.

This was regarding the production-grade OpenShift platform; if you want to test the features of OpenShift from a developer perspective, the fastest and easiest way will be to use OpenShift Sandbox ready available from RedHat, where you can immediately start testing and deploying your application, and play with OpenShift.

For creating an OpenShif cluster for a production environment, all the deployment options are available from the OpenShift installer; from this portal, you can follow the steps necessary to deploy your cluster on the cloud, inside your data center, or even on your local machine for testing.

If you decided to move on and build a test environment with single node OpenShif, the following options would be interesting to you:

OKD (Origin Kubernetes Distribution): OKD is the community-driven distribution of Kubernetes that powers OpenShift. It provides a feature-rich, open-source platform for building and deploying containerized applications. Features include source-to-image (S2I) builds, integrated registry, monitoring, and logging capabilities, role-based access control (RBAC), web console, and more.

OpenShift Origin: Historically, OpenShift Origin was the upstream open-source project for OpenShift. However, as of version 3.11, OpenShift Origin was replaced by OKD. OKD serves as the upstream for community distribution.

RedHat OpenShift Local: The previous name was CodeReady Containers (CRC), a developer-focused version of OpenShift that runs locally on a developer’s machine or VM. It provides a single-node OpenShift cluster for developers to build, test, and deploy applications locally before deploying them to a production cluster.

Installing OpenShift for Development

To keep this post short and sweet, we will move with the last option, “OpenShif Local,” the easiest and fastest way to proceed with a single-node OpenShift for our testing purposes. In the next articles, we will install a production-grade OpenShift cluster with other methods.

I will be installing CRC on a remote VM, “CentOS9” The first step, we head to the local tap of the OpenShift installer page; from there, we should be able to download the installation files.

We can copy the link from the “download OpenShift local” and use the wget to download the files:

wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz

Then we have to extract the file, for example:

tar xvf crc-linux-amd64.tar.xz

I moved the CRC command, “which is the main program to install the -OpenShift local-” to my home directory, you can move it to any other place, but you have to add it to your PATH.

mv crc-linux-2.24.1-amd64/crc .
export PATH=$PATH:$HOME
crc version

You should see a result like the one below for the version you used for CRC:

Now we can run the installation:

crc setup

The setup program will install the required packages, including the virtualization packages

Then when the installation is finished, you should get something like below:

Now we can start the OpenShift instance with:

crc start

During starting the service, you will get a prompt to paste the pull secret, which you copy from the installation portal:

A successful start for the OpenShift will lead to output similar to below:

Now try logging in with the instructions provided above; you may face a warning about an untrusted certificate, and you can choose to proceed.

I created a new web project using the oc command line; oc is a tool similar to kubectl but used for OpenShift.

oc new-project web

Also, using the URL “https://console-openshif-console.apps-crc.testing” provided after installation succeeds, we can access the portal, notice this URL is provided and cannot be changed as OpenShift wants to keep this for testing only, as I’m installing on a remote machine I did some workarounds to be able to reach it, but will keep this out of this article. You can walk through the web interface and explore OpenShift different options and taps.

One thing you might encounter once you start using OpenShift is that it comes by default more secure than standard Kubernetes; by default, it won't allow the privileged containers to run, as this is a security risk.

So to proceed with our standard nginx application deployment, for example, we must use an unprivileged container. I’ll be using nginxinc/nginx-unprivileged to achieve this.

Now let's search for a template of nginx in OpenShift:

Let's deploy it:

oc create deployment web-nginx --image=nginxinc/nginx-unprivileged

Getting status after a some seconds

Final Word

In this article, we talked about different versions of OpenShift with different options for installation, and we walked through installing a local version of OpenShift which can be used for development and testing. OpenShift is a powerful Kubernetes platform supported by RedHat with a big market share of the Kubernetes market; the chance that you encounter OpenShift working as DevOps or SRE is quite high, and for this reason, it makes good sense to have some hands-on OpenShift.

--

--

Ayman Abu Qutriyah
Kubernetes DeveOps

IT infrastructure Architect/RedHat Architect with extensive experience in DevOps, Paas, kubernetes and OpenSource technologies