OpenShift Container Platform 4.11 Cluster Setup
In this article, I will walk you through OpenShift Container Platform 4.11 cluster setup on Linux. Further, I will be creating a namespace and deployment on OCP cluster.
Join the DZone community and get the full member experience.
Join For FreeIntroduction
In this article, I will walk you through OpenShift Container Platform 4.11 cluster setup on Linux. Further, I will be creating a namespace and deployment on OCP cluster.
Prerequisite
Register and create a red hat account using this link: Redhat User Registration Page. Once an account has been created, log on to the red hat developer portal using this link: OCP Cluster Page.
Minimum Hardware requirement for OpenShift Container Platform.
- 4 physical CPU cores
- 9 GB of free RAM memory
- 35 GB of storage space
Minimum OS requirement.
- RHEL 7,8, and 9.
There are multiple other platforms and OS version OpenShift Container Platform installation supported. Here is the official link from Red Hat Min-Sys-Requirement for supported platforms.
Creating OCP Cluster
Once all the prerequisites are satisfied, click on OCP Cluster Page, then click on create cluster.
Then select an OpenShift cluster type to create as local, where Red Hat offers cloud and on-premises BareMetal. For our use case, we are selecting local, which will create a minimal cluster on your desktop/laptop for local development and testing.
As highlighted in yellow in the above image, based on your local desktop/laptop Operating System, select the supported operating system from Linux/Windows and macOS. For this article, we are selecting Linux since my local operating system on RHEL 9.
After Selecting OS then, click on “Download OpenShiftLocal," which will download a package with the file name crc-linux-amd64.tar.xz
, then download or copy your pull secret. You'll be prompted for this information during installation.
Copy the OpenShift Local archive for your operating system from the download directory to the target path(/opt/oclab)
and extract or place the binary in your $PATH or by creating a directory /opt/oclab
as shown below.
sudo mkdir -p /opt/oclab
sudo chwon -R ocadmin:ocadmin /opt/oclab
sudo su – ocadmin
cd /opt/oclab
cp -p /tmp/crc-linux-amd64.tar.xz .
tar -xvf crc-linux-amd64.tar.xz
The output will be like below, as shown.
Extract the CRC package under /opt/oclab
then execute “CRC setup” to set up your host operating system for the OpenShift Local virtual machine and run the below commands.
cd /opt/oclab
cd crc-linux-2.12.0-amd64/
./crc setup
The output will be like below, as shown.
Then, run crc start
to create a minimal OpenShift 4 cluster on your computer.
cd /home/ocadmin/.crc/bin
./crc start
We can see while crc start-up
execution provisioning a CRC VM
with the required configuration.
Creating CRC VM for OpenShift 4.11.18 cluster with the following operators DNS, image-registry, network, openshift-controller-manager
, operator-lifecycle-manager-packageserver
the installation will be completed. A CRC-admin
and CRC-developer
context to kubeconfig
will be configured for the OpenShift cluster.
echo "export PATH=$PATH:<crc-extracted-path>/.crc/cache/crc_libvirt_4.11.18_amd64/" >>.bash_profile
Example:
echo "export PATH=$PATH:/home/ocadmin/.crc/cache/crc_libvirt_4.11.18_amd64/" >>.bash_profile
Once crc
is started up, that will display kubeadmin
and developer credentials with web-GUI URL details and an oc
cli
command to log onocp
cluster.
As mentioned, above OpenShift cluster started, which is accessible through oc
command line and web console.
Login into the OCP cluster master node and run the following commands to get a number of nodes, create a project, and schedule the deployment.
oc get nodes
oc create namespace cgt-app-ui
oc create deployment app-ui –image=nginx:latest –replicas=1 -n cgt-app-ui
Output for the above command execution will be as shown below.
Summary
Red Hat OpenShift Local is a great place where you can quickly spin up an OpenShift cluster for development purposes. It uses a single node that behaves as both a control plane and a worker node. For example, when migrating applications to microservices on containers, these containers will be orchestrated from Red Hat OpenShift.
Opinions expressed by DZone contributors are their own.
Comments