Install Red Hat OpenShift Local (CodeReady Container) on windows laptop

In this article, I will share how you can install Red Hat OpenShift Local (formerly CodeReady Container) on a Windows laptop. Openshift is a popular cloud platform these days. Red Hat Openshift introduced Red Hat OpenShift Local, enabling us to install and spin up a minimal and per-configured version of OpenShift v4.1 (or newer) on our local laptop for development and testing purposes. It was known as CodeReady Container earlier.

MiniShift vs. Red Hat OpenShift Local

I wrote a tutorial on installing MiniShift in the local system sometime back. Let me briefly discuss the difference between MiniShift and Red Hat Openshift Local. MiniShift helped us run OKD 3.11(OpenShift community/open-source edition v3.11) in our local system.

Red Hat OpenShift Local lets us install and run OpenShift version 4.1 (or newer) cluster in our local system.

Our focus here is on Redhat OpenShift CodeReady Container. Let’s proceed.

Prerequisite to install Red Hat OpenShift Local

Hardware requirement

It needs a minimum of 4 core CPUs, 9 GB of free RAM, and 35 GB of storage space. However, having more resources at our disposal is better to ensure there is no resource shortage and disruptions when it runs. My laptop has 16 GB RAM, 8 cores, and 16 logical processors.

OS requirement

For running CRC on Windows machines, use Windows 10 Fall Creators Update (v 1709) or newer. In my case, I am using Windows 11 Pro.

Hypervisor

The system should be capable of virtualization. Please don’t install it in a VM as there can be an issue of nested virtualization. In my case, I’ll use the native hypervisor (Hyper-V) of Windows. To ensure that Hyper-V is enabled, please go to “Control Panel” -> “Programs” -> “Turn Windows Features on or off.”. A window will pop up. Check the Hyper-V checkbox and restart the machine.

Registration/Login

To install the Red Hat OpenShift Local, you must have a Red Hat account. You can create it free of cost. If you already have an account, head to https://developers.redhat.com/products/codeready-containers/overview and click on the “Install OpenShift on your laptop” button. It’ll redirect you to the login page if you have not already logged in. Key in your credential and log in.

Please check the official page for minimum system requirement.

https://access.redhat.com/documentation/en-us/red_hat_openshift_local/2.2/html/getting_started_guide/installation_gsg#minimum-system-requirements_gsg

Download & Install

  • Once logged in, ensure to select the appropriate OS. In this article, I am demonstrating with Windows. Click on the “Download CodeReady Containers” button.
  • Also, click the “Download pull secret” button to download the pull secret that we’ll use later.
download OpenShift code ready container
download the OpenShift code-ready container and copy the secret.
  • Extract the content of the zip file in any folder
  • Double-click on the crc-windows-amd64.msi file to launch the installation wizard.
  • Follow the simple wizard and install the Code Ready Container platform in your system.
  • Now open a command prompt & issue the following command to check the version of the CodeReady container and which version of the OpenShift cluster it will spin up after we set it up.
C:\Users\sadruddin>crc version

CRC version: 2.31.0+6d23b6
OpenShift version: 4.14.7
Podman version: 4.4.4

Usage Data Collection Settings

You can give consent or deny sharing optional usage data collection with Red Hat. This data helps them make the platform better.

  • Use the following command to give consent to share usage data.
C:\>crc config set consent-telemetry yes
Successfully configured consent-telemetry to yes
  • Use the following command to disable sharing the usage data.
C:\>crc config set consent-telemetry no
Successfully configured consent-telemetry to no
  • At any point, to check what you have already configured, run the following command:
C:\>crc config view
- consent-telemetry                     : no
  • Please note that we’ll also see this same setting below when we do the setup of CRC.

Know about Red Hat OpenShift Local presets

Before we start with setting up the Red Hat OpenShift Local, let’s take a look at what presets are:

In Red Hat OpenShift Local, presets represent a managed container runtime and the lower bounds of system resources required by the instance to run it. It offers presets for openshift, microshift and the podman container runtime.

https://access.redhat.com/documentation/en-us/red_hat_openshift_local/2.2/html/getting_started_guide/using_gsg

In this tutorial, we’ll use the default presets as an openshift container platform. It’ll run a complete OpenShift cluster environment as a single node, providing a registry and access to the Operator. We can view the preset by running the following command.

C:\Users\sadruddin>crc config get preset

Configuration property 'preset' is not set. Default value 'openshift' is used

We can change our preference of preset by using the following command. For example, to use podman as the preset, we can run this command:

C:\Users\sadruddin>crc config set preset podman

To confirm your system is ready, and you have the needed system bundle, please run 'crc setup' before 'crc start'.

C:\Users\sadruddin>crc config get preset
preset : podman

Setup and start CRC

  • To set up the CRC, run the following command: crc setup. It will take a while for the first time, to download heavy files to proceed with the setup process.
C:\Users\sadruddin>crc setup

INFO Using bundle path C:\Users\sadruddin\.crc\cache\crc_hyperv_4.14.7_amd64.crcbundle
INFO Checking minimum RAM requirements
INFO Checking if current user is in crc-users and Hyper-V admins group
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if C:\Users\sadruddin\.crc\cache\crc_hyperv_4.14.7_amd64.crcbundle exists
INFO Getting bundle for the CRC executable
INFO Downloading bundle: C:\Users\sadruddin\.crc\cache\crc_hyperv_4.14.7_amd64.crcbundle...
4.68 GiB / 4.68 GiB [----------------------------------------------------------------------------------------------------------] 100.00% 1.70 MiB/s
INFO Uncompressing C:\Users\sadruddin\.crc\cache\crc_hyperv_4.14.7_amd64.crcbundle
crc.vhdx: 19.65 GiB / 19.65 GiB [--------------------------------------------------------------------------------------------------------] 100.00%
oc.exe: 117.16 MiB / 117.16 MiB [--------------------------------------------------------------------------------------------------------] 100.00%
INFO Checking if the win32 background launcher is installed
INFO Checking if the daemon task is installed
INFO Installing the daemon task
INFO Checking if the daemon task is running
INFO Running the daemon task
INFO Checking admin helper service is running
Your system is correctly setup for using CRC. Use 'crc start' to start the instance

  • Now, issue the following command to start crc and supply the secret when prompted:
C:\Users\sadruddin>crc start

INFO Using bundle path C:\Users\sadruddin\.crc\cache\crc_hyperv_4.14.7_amd64.crcbundle
INFO Checking minimum RAM requirements
INFO Checking if running in a shell with administrator rights
INFO Checking Windows release
INFO Checking Windows edition
INFO Checking if Hyper-V is installed and operational
INFO Checking if Hyper-V service is enabled
INFO Checking if crc-users group exists
INFO Checking if current user is in crc-users and Hyper-V admins group
INFO Checking if vsock is correctly configured
INFO Checking if the win32 background launcher is installed
INFO Checking if the daemon task is installed
INFO Checking if the daemon task is running
INFO Checking admin helper service is running
INFO Loading bundle: crc_hyperv_4.14.7_amd64...
INFO Creating CRC VM for OpenShift 4.14.7...
INFO Generating new SSH key pair...
INFO Generating new password for the kubeadmin user
INFO Starting CRC VM for openshift 4.14.7...
INFO CRC instance is running with IP 127.0.0.1
INFO CRC VM is running
INFO Updating authorized keys...
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 until the user's pull secret is written to the 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 4 operators are progressing: console, image-registry, ingress, openshift-controller-manager
INFO 2 operators are progressing: console, openshift-controller-manager
INFO 2 operators are not available: authentication, console
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...
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: ********

Log in as user:
Username: developer
Password: *********

Use the 'oc' command line interface:
> @FOR /f "tokens=*" %i IN ('crc oc-env') DO @call %i
> oc login -u developer https://api.crc.testing:6443

Credentials for OpenShift CRC

To obtain the credentials for the OpenShift cluster we just started, open a terminal and issue the crc console –credentials command.

C:\>crc console --credentials
To login as a regular user, run 'oc login -u developer -p YOUR_DEVELOPER_PASSWORD https://api.crc.testing:6443'.
To login as an admin, run 'oc login -u kubeadmin -p YOUR_ADMIN_PASSWORD https://api.crc.testing:6443'

Access OpenShift Web Console

C:\>crc console
Opening the OpenShift Web Console in the default browser...

Setup to use OC command

oc is a powerful command-line tool we can use to create applications and manage the OpenShift cluster. The oc CLI tool automatically gets installed during our installation/setup process. We need to add the location of this tool in the PATH so that we can use it seamlessly from the command prompt.

  • Launch the command prompt and issue crc oc-env command
crc oc-env
SET PATH=C:\Users\sadruddin\.crc\bin\oc;%PATH%
REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('crc oc-env') DO @call %i
  • Next, run the printed command above
SET PATH=C:\Users\sadruddin\.crc\bin\oc;%PATH%
  • Now, you can easily manage the OpenShift cluster using the CLI. For example, execute the following command to log in to the Red Hat OpenShift Local cluster:
oc login -u developer -p YOUR_DEVELOPER_PASSWORD https://api.crc.testing:6443
Login successful.

You don't have any projects. You can try to create a new project, by running

oc new-project <projectname>
  • Once successfully logged in, you can use the oc command for various interactions with the OpenShift cluster

Stopping the CRC instance

We can run the following command to stop the locally installed OpenShift and container runtime: crc stop

C:\Users\sadruddin>crc stop

INFO Stopping kubelet and all containers...
INFO Stopping the instance, this may take a few minutes...
Stopped the instance

Deleting the CRC instance

We can run the following command to delete the Red Hat Openshift Local Instance: crc delete

Reference

https://developers.redhat.com/products/openshift-local/overview?source=sso

285

No Responses

Write a response

This site uses Akismet to reduce spam. Learn how your comment data is processed.