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 
12
$ grep MemTotal /proc/meminfo 
MemTotal:       32658632 kB

We are going to use the server to 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.

17 thoughts on “EX180 Series: Install Podman and Set up OpenShift Using CodeReady Containers

  1. I tried to setup a homelab server:
    8 CPUs
    16GB of RAM
    200GB of disk space
    OS Centos Stream 8 … That’s the only obvious difference.

    Errors vary.

    I don’t want to reinstall the OS. Any ideas? Just curious if you may notice something really obvious. Maybe more memory?

    • The problems begin after:
      $ crc start
      #==========
      At times… the ssh connection drops
      #==========
      Then it’s:

      Failed to connect to the CRC VM with SSH — virtual machine might be unreachable: Temporary error: ssh command error:
      command : exit 0
      err : Error getting config for native Go SSH: ssh: no key found
      (x300)

    • It is possible that the OpenShift VM got broken somehow. You can try the following to see if it helps:

      $ crc delete
      $ rm -r /home/centos/.crc
      $ crc config [your config parameters]
      $ crc setup
      $ crc start
    • $ crc version
      CRC version: 2.12.0+74565a6
      OpenShift version: 4.11.18
      Podman version: 4.2.0

  2. $ crc status
    CRC VM: Running
    OpenShift: Unreachable (v4.11.18)
    RAM Usage: 0B of 0B
    Disk Usage: 0B of 0B (Inside the CRC VM)
    Cache Usage: 16.18GB
    Cache Directory: /home/centos/.crc/cache

  3. After following your steps – specifically: rm -r /home/centos/.crc
    I see a different error message…
    #===============
    INFO Waiting for kube-apiserver availability… [takes around 2min]

    Failed to update cluster pull secret: Temporary error: ssh command error:
    command : timeout 5s oc get secret –context admin –cluster crc –kubeconfig /opt/kubeconfig
    err : Process exited with status 124
    (x11)
    #================
    … I see something strange… this is a fresh Centos Stream 8 install and /opt is … empty

    • I don’t use CentOS Stream 8 as it’s not production ready therefore cannot advise much I’m afraid, but it does work with Rocky Linux 8. You may want to reach out to CentOS Stream community to see if anyone’s got a similar issue.

  4. I tried RockyLinux 8 and had similar problems. I increased the HW resources and it works now on Centos 8 Stream.
    CRC VM: Running
    OpenShift: Running (v4.12.1)
    RAM Usage: 6.564GB of 9.399GB
    Disk Usage: 16.84GB of 32.74GB (Inside the CRC VM)
    Cache Usage: 16.53GB
    Cache Directory: /home/centos/.crc/cache

    • I did not try to increase the HW on Rocky Linux. Just did a fresh re-install with Cent8 Stream.
      – 40 virtual CPUs (vCPUs): from 8
      – 70 GB of RAM: from 16 GB
      – 3.4 TB of disk space: from 200 GB

Leave a Reply to Luis F Cancel reply

Your email address will not be published. Required fields are marked *