If you want to run a local Red Hat OpenShift on your Laptop then this guide is written just for you. This guide is not meant for Production setup or any use where actual customer traffic is anticipated. CRC is a tool created for deployment of minimal OpenShift Container Platform 4 cluster and Podman container runtime on a local computer. This is fit for development and testing purposes only. Local OpenShift is mainly targeted at running on developers’ desktops. For deployment of Production grade OpenShift Container Platform use cases, refer to official Red Hat documentation on using the full OpenShift installer.

How to install PHP 8 on CentOS 8 an...
How to install PHP 8 on CentOS 8 and RHEL 8

We also have guide on running Red Hat OpenShift Container Platform in KVM virtualization;

Here are the key points to note about Local Red Hat OpenShift Container platform using CRC:

  • The cluster is ephemeral
  • Both the control plane and worker node runs on a single node
  • The Cluster Monitoring Operator is disabled by default.
  • There is no supported upgrade path to newer OpenShift Container Platform versions
  • The cluster uses 2 DNS domain names, crc.testing and apps-crc.testing
  • crc.testing domain is for core OpenShift services and apps-crc.testing is for applications deployed on the cluster.
  • The cluster uses the 172 address range for internal cluster communication.

Requirements for running Local OpenShift Container Platform:

  • A computer with AMD64 and Intel 64 processor
  • Physical CPU cores: 4
  • Free memory: 9 GB
  • Disk space: 35 GB

1. Local Computer Preparation

We shall be performing this installation on a Red Hat Linux 9 system.

$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.0 (Plow)

OS specifications are as shared below:

[[email protected] ~]$ free -h
               total        used        free      shared  buff/cache   available
Mem:            31Gi       238Mi        30Gi       8.0Mi       282Mi        30Gi
Swap:            9Gi          0B         9Gi

[[email protected] ~]$ grep -c ^processor /proc/cpuinfo
8

[[email protected] ~]$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b2:42:4e:64:fb:17 brd ff:ff:ff:ff:ff:ff
    altname enp0s18
    inet 192.168.207.2/24 brd 192.168.207.255 scope global noprefixroute ens18
       valid_lft forever preferred_lft forever
    inet6 fe80::b042:4eff:fe64:fb17/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

For RHEL register system

If you’re performing this setup on RHEL system, use the commands below to register the system.

$ sudo subscription-manager register --auto-attach
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: <RH-USERNAME>
Password: <RH-PASSWORD>
The registered system name is: crc.example.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status:       Subscribed

The command will automatically associate any available subscription matching the system. You can also provide username and password in one command line.

sudo subscription-manager register --username <username> --password <password> --auto-attach

If you would like to register system without immediate subscription attachment, then run:

sudo subscription-manager register

Once the system is registered, attach a subscription from a specific pool using the following command:

sudo subscription-manager attach --pool=<POOL_ID>

To find which pools are available in the system, run the commands:

sudo subscription-manager list --available
sudo subscription-manager list --available --all

Update your system and reboot

sudo dnf -y update
sudo reboot

Install required dependencies

You need to install libvirt and NetworkManager packages which are the dependencies for running local OpenShift cluster.

### Fedora / RHEL 8+ ###
sudo dnf -y install wget vim NetworkManager

### RHEL 7 / CentOS 7 ###
sudo yum -y install wget vim NetworkManager

### Debian / Ubuntu ###
sudo apt update
sudo apt install wget vim libvirt-daemon-system qemu-kvm libvirt-daemon network-manager

2. Download Red Hat OpenShift Local

Next we download CRC portable executable. Visit Red Hat OpenShift downloads page to pull local cluster installer program.

crc install 01

Under Cluster select “Local” as option to create your cluster. You’ll see Download link and Pull secret download link as well.

crc install 02

Here is the direct download link provided for reference purposes.

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

Extract the package downloaded

tar xvf crc-linux-amd64.tar.xz

Move the binary file to location in your PATH:

sudo mv crc-linux-*-amd64/crc /usr/local/bin
sudo rm -rf crc-linux-*-amd64/

Confirm installation was successful by checking software version.

$ crc version
CRC version: 2.7.1+a8e9854
OpenShift version: 4.11.0
Podman version: 4.1.1

Data collection can be enabled or disabled with the following commands:

#Enable
crc config set consent-telemetry yes

#Disable
crc config set consent-telemetry no

3. Run Local OpenShift Cluster in Linux Computer

You’ll run the crc setup command to create a new Red Hat OpenShift Local Cluster. All the prerequisites for using CRC are handled automatically for you.

$ crc setup
CRC is constantly improving and we would like to know more about usage (more details at https://developers.redhat.com/article/tool-data-collection)
Your preference can be changed manually if desired using 'crc config set consent-telemetry <yes/no>'
Would you like to contribute anonymous usage statistics? [y/N]: y
Thanks for helping us! You can disable telemetry with the command 'crc config set consent-telemetry no'.
INFO Using bundle path /home/jkmutai/.crc/cache/crc_libvirt_4.11.0_amd64.crcbundle
INFO Checking if running as non-root
INFO Checking if running inside WSL2
INFO Checking if crc-admin-helper executable is cached
INFO Caching crc-admin-helper executable
INFO Using root access: Changing ownership of /home/jkmutai/.crc/bin/crc-admin-helper-linux
INFO Using root access: Setting suid for /home/jkmutai/.crc/bin/crc-admin-helper-linux
INFO Checking for obsolete admin-helper executable
INFO Checking if running on a supported CPU architecture
INFO Checking minimum RAM requirements
INFO Checking if crc executable symlink exists
INFO Creating symlink for crc executable
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Installing libvirt service and dependencies
INFO Using root access: Installing virtualization packages
INFO Checking if user is part of libvirt group
INFO Adding user to libvirt group
INFO Using root access: Adding user to the libvirt group
INFO Checking if active user/process is currently part of the libvirt group
INFO Checking if libvirt daemon is running
WARN No active (running) libvirtd systemd unit could be found - make sure one of libvirt systemd units is enabled so that it's autostarted at boot time.
INFO Starting libvirt service
INFO Using root access: Executing systemctl daemon-reload command
INFO Using root access: Executing systemctl start libvirtd
INFO Checking if a supported libvirt version is installed
INFO Checking if crc-driver-libvirt is installed
INFO Installing crc-driver-libvirt
INFO Checking crc daemon systemd service
INFO Setting up crc daemon systemd service
INFO Checking crc daemon systemd socket units
INFO Setting up crc daemon systemd socket units
INFO Checking if systemd-networkd is running
INFO Checking if NetworkManager is installed
INFO Checking if NetworkManager service is running
INFO Checking if /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf exists
INFO Writing Network Manager config for crc
INFO Using root access: Writing NetworkManager configuration to /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf
INFO Using root access: Changing permissions for /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf to 644
INFO Using root access: Executing systemctl daemon-reload command
INFO Using root access: Executing systemctl reload NetworkManager
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists
INFO Writing dnsmasq config for crc
INFO Using root access: Writing NetworkManager configuration to /etc/NetworkManager/dnsmasq.d/crc.conf
INFO Using root access: Changing permissions for /etc/NetworkManager/dnsmasq.d/crc.conf to 644
INFO Using root access: Executing systemctl daemon-reload command
INFO Using root access: Executing systemctl reload NetworkManager
INFO Checking if libvirt 'crc' network is available
INFO Setting up libvirt 'crc' network
INFO Checking if libvirt 'crc' network is active
INFO Starting libvirt 'crc' network
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if /home/jkmutai/.crc/cache/crc_libvirt_4.11.0_amd64.crcbundle exists
INFO Getting bundle for the CRC executable
INFO Downloading crc_libvirt_4.11.0_amd64.crcbundle

CRC bundle is downloaded locally within few seconds / minutes depending on your network connectivity speed.

INFO Downloading crc_libvirt_4.11.0_amd64.crcbundle
3.28 GiB / 3.28 GiB [----------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 85.19 MiB p/s
INFO Uncompressing /home/jkmutai/.crc/cache/crc_libvirt_4.11.0_amd64.crcbundle
crc.qcow2: 12.48 GiB / 12.48 GiB [-----------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%
oc: 118.13 MiB / 118.13 MiB [----------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00%

Once the system is correctly setup for using CRC, start the new Red Hat OpenShift Local instance:

$ crc start
INFO Checking if running as non-root
INFO Checking if running inside WSL2
INFO Checking if crc-admin-helper executable is cached
INFO Checking for obsolete admin-helper executable
INFO Checking if running on a supported CPU architecture
INFO Checking minimum RAM requirements
INFO Checking if crc executable symlink exists
INFO Checking if Virtualization is enabled
INFO Checking if KVM is enabled
INFO Checking if libvirt is installed
INFO Checking if user is part of libvirt group
INFO Checking if active user/process is currently part of the libvirt group
INFO Checking if libvirt daemon is running
INFO Checking if a supported libvirt version is installed
INFO Checking if crc-driver-libvirt is installed
INFO Checking crc daemon systemd socket units
INFO Checking if systemd-networkd is running
INFO Checking if NetworkManager is installed
INFO Checking if NetworkManager service is running
INFO Checking if /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf exists
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists
INFO Checking if libvirt 'crc' network is available
INFO Checking if libvirt 'crc' network is active
INFO Loading bundle: crc_libvirt_4.11.0_amd64...
CRC requires a pull secret to download content from Red Hat.
You can copy it from the Pull Secret section of https://console.redhat.com/openshift/create/local.

Paste the contents of the Pull secret.

? Please enter the pull secret <PASTE-PULL-SECRET-FROM-REDHAT-PORTAL>

This can be obtained from Red Hat OpenShift Portal.

crc install 03

Local OpenShift cluster creation process should continue.

INFO Creating CRC VM for openshift 4.11.0...
INFO Generating new SSH key pair...
INFO Generating new password for the kubeadmin user
INFO Starting CRC VM for openshift 4.11.0...
INFO CRC instance is running with IP 192.168.130.11
INFO CRC VM is running
INFO Updating authorized keys...
INFO Configuring shared directories
INFO Check internal and public DNS query...
INFO Check DNS query from host...
INFO Verifying validity of the kubelet certificates...
INFO Starting kubelet service
INFO Waiting for kube-apiserver availability... [takes around 2min]
INFO Adding user's pull secret to the cluster...
INFO Updating SSH key to machine config resource...
INFO Waiting for user's pull secret part of instance disk...
INFO Changing the password for the kubeadmin user
INFO Updating cluster ID...
INFO Updating root CA cert to admin-kubeconfig-client-ca configmap...
INFO Starting openshift instance... [waiting for the cluster to stabilize]
INFO 3 operators are progressing: image-registry, network, openshift-controller-manager
[INFO 3 operators are progressing: image-registry, network, openshift-controller-manager
INFO 2 operators are progressing: image-registry, openshift-controller-manager
INFO Operator openshift-controller-manager is progressing
INFO Operator authentication is not yet available
INFO Operator kube-apiserver is progressing
INFO All operators are available. Ensuring stability...
INFO Operators are stable (2/3)...
INFO Operators are stable (3/3)...
INFO Adding crc-admin and crc-developer contexts to kubeconfig...

If creation was successful you should get output like below in your console.

Started the OpenShift cluster.

The server is accessible via web console at:
  https://console-openshift-console.apps-crc.testing

Log in as administrator:
  Username: kubeadmin
  Password: yHhxX-fqAjW-8Zzw5-Eg2jg

Log in as user:
  Username: developer
  Password: developer

Use the 'oc' command line interface:
  $ eval $(crc oc-env)
  $ oc login -u developer https://api.crc.testing:6443

Virtual Machine created can be checked with virsh command:

$ sudo virsh list
 Id   Name   State
----------------------
 1    crc    running

4. Manage Local OpenShift Cluster using crc commands

Update number of vCPUs available to the instance:

crc config set cpus <number>

Configure the memory available to the instance:

$ crc config set memory <number-in-mib>

Display status of the OpenShift cluster

## When running ###
$ crc status
CRC VM:          Running
OpenShift:       Running (v4.11.0)
Podman:
Disk Usage:      15.29GB of 32.74GB (Inside the CRC VM)
Cache Usage:     17.09GB
Cache Directory: /home/jkmutai/.crc/cache

## When Stopped ###
$ crc status
CRC VM:          Stopped
OpenShift:       Stopped (v4.11.0)
Podman:
Disk Usage:      0B of 0B (Inside the CRC VM)
Cache Usage:     17.09GB
Cache Directory: /home/jkmutai/.crc/cache

Get IP address of the running OpenShift cluster

$ crc ip
192.168.130.11

Open the OpenShift Web Console in the default browser

crc console

Accept SSL certificate warnings to access OpenShift dashboard.

crc install 04

Accept risk and continue

crc install 05

Authenticate with username and password given on screen after deployment of crc instance.

crc install 06

 The following command can also be used to view the password for the developer and kubeadmin users:

crc console --credentials

To stop the instance run the commands:

crc stop

If you want to permanently delete the instance, use:

crc delete

5. Configure oc environment

Let’s add oc executable our system’s PATH:

$ crc oc-env
export PATH="/home/jkmutai/.crc/bin/oc:$PATH"
# Run this command to configure your shell:
# eval $(crc oc-env)

$ vim ~/.bashrc
export PATH="/home/$USER/.crc/bin/oc:$PATH"
eval $(crc oc-env)

Logout and back in to validate it works.