EX180 Series: Install Podman and Set up OpenShift Using CodeReady Containers

I’ll be taking Red Hat’s EX180 exam in a couple of weeks, so I thought I’d get a homelab set up to go through study material.

EX180 is Red Hat’s certified specialist in containers and Kubernetes exam.

EX180 Homelab Pre-requisites

In order to deploy CodeReady containers, we need a server that meets the following hardware requirements:

  1. 4 virtual CPUs (vCPUs),
  2. 9GB of RAM,
  3. 31GB of disk space.

With regards to OS, we are going to use Rocky Linux 8.

A Red Hat account is required in order to download a pull-secret from Red Hat Hybrid Cloud Console.

SELinux is set to enforcing mode on the server.

The Plan

We have a physical server with 12 CPU cores and 32GB of RAM that runs Rocky Linux 8.

$ grep -c processor /proc/cpuinfo 
$ grep MemTotal /proc/meminfo 
MemTotal:       32658632 kB

We are going to use the server to install install Podman, set up Qemu-KVM hypervisor and deploy OpenShift using CodeReady containers. We will then use the environment to prepare for the EX180 exam.

Do note that OpenShift VM needs 4 CPUs and 9GB of RAM to run as mentioned in the pre-requisites section.

Install Podman

Install podman package:

$ sudo yum install -y podman

Check software version:

$ podman version

Install Libvirt with QEMU-KVM

KVM is ubiquitous in a way that its built into Linux and requires virtually (no pun intended) no effort to set it up. KVM lets you turn Linux into a type 1 bare-metal hypervisor.

Install the necessary packages:

$ sudo yum install -y qemu-kvm libvirt
$ sudo systemctl enable --now libvirtd
$ sudo usermod -aG libvirt,qemu ${USER}

Install OpenShift

Download the pull secret from the Pull Secret section of the CRC page on the Red Hat Hybrid Cloud Console and save it as pull-secret.json.

Download the latest release of CRC for your platform.

$ cd /tmp
$ curl -sSL -o crc-linux-amd64.tar.xz https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz
$ tar xvf ./crc-linux-amd64.tar.xz
$ rm -f ./crc-linux-amd64.tar.xz
$ sudo cp ./crc-linux-*-amd64/crc /usr/local/bin/

Check the version of crc:

$ crc version
CRC version: 2.10.2+1bc2e5a
OpenShift version: 4.11.7
Podman version: 4.2.0

In this case we are going to use OpenShift 4.11 which is based on Kubernetes 1.24.

Configure CodeReady containers:

$ crc config set cpus 4
$ crc config set memory 10240
$ crc config set disk-size 31
$ crc config set kubeadmin-password changeme
$ crc config set consent-telemetry no
$ crc config set enable-cluster-monitoring no
$ crc config set disable-update-check yes

CRC will refuse to run as root, therefore you have to start the process as a regular user.

Make sure that your /proc filesystem is not mounted with hidepid=2 option. This option hides the /proc from your shell that uses polkit.

$ crc setup
$ crc start --pull-secret-file ./pull-secret.json

Retrieve the password for the developer and kubeadmin users:

$ crc console --credentials
To login as a regular user, run 'oc login -u developer -p developer https://api.crc.testing:6443'.
To login as an admin, run 'oc login -u kubeadmin -p changeme https://api.crc.testing:6443'

Access OpenShift Cluster with oc

Use the oc command line interface:

$ eval $(crc oc-env)

Log in to OpenShift as admin:

$ oc login -u kubeadmin https://api.crc.testing:6443

Check the node status:

$ oc get no
NAME                 STATUS   ROLES           AGE   VERSION
crc-lgph7-master-0   Ready    master,worker   44d   v1.24.0+3882f8f

What’s Next?

We will look into building images and running container with Podman.

Leave a Reply

Your email address will not be published.