{{announcement.body}}
{{announcement.title}}

How to Run Red Hat OpenShift 4 on your Notebook

DZone 's Guide to

How to Run Red Hat OpenShift 4 on your Notebook

This tutorial demonstrates how to install and run Red Hat OpenShift 4 using CodeReady Containers.

· Cloud Zone ·
Free Resource

OpenShift is Red Hat's version of Kubernetes, simply put. It includes tools and features that make it very interesting for developers. But since it is a commercial product it normally comes with a fee.

You may know Minikube, a tool to run "vanilla" Kubernetes in a virtual machine on your notebook. You may also know Minishift, which does the same for OKD which is the open source upstream project of OpenShift. Minishift is based on OKD version 3.xx, though. OpenShift version 4 is very different from OpenShift and OKD version 3. There is work underway for a version 4 of OKD but this still seems to take some time.

Last year I found something called Red Hat CodeReady Containers that allows you to run OpenShift 4.3 in a single node configuration on your workstation. It operates almost exactly like Minishift and Minikube. Actually, under the hood, it works completely different but that’s another story. 

CodeReady Containers (CRC) runs on Linux, MacOS, and Windows, and it only supports the native hypervisors: KVM for Linux, Hyperkit for MacOS, and HyperV for Windows. 

This is the place where you need to start: Install on Laptop: Red Hat CodeReady Containers

You need a Red Hat account to access this page, you can register right there and it is free. It contains a link to the Getting Started guide, the download link for CodeReady Containers (for Windows, macOS, and Linux) and a link to download the  pull secret  which is required during installation and is, therefore, the most important piece.

The Getting Started guide lists the hardware requirements, they are similar to those for Minikube and Minishift:

  • 4 vCPUs
  • 8 GB RAM (honestly, you need at least 16 GB to use CRC)
  • 35 GB disk space for the virtual disk

You will also find the required versions of Windows 10 and macOS there. 

I am running Fedora (F30 at the moment) on my notebook and I normally use VirtualBox as the hypervisor. CRC does not support VirtualBox so I had to install KVM first (here are good instructions). The requirements for CRC also mention NetworkManager as required but most Linux distributions will use it, Fedora certainly does. There are additional instructions for Ubuntu/Debian/Mint users for libvirt in the Getting Started guide and here.

Start with downloading the CodeReady Containers archive for your OS and download the pull secrets to a location you remember. Extracting the CodeReady Containers archive results in an executable "crc" which needs to be placed in your PATH. This is very similar to the "minikube" and "minishift" executables.

The first step is to setup CodeReady Containers:

 $ crc setup 

This checks the prerequisites, installs some drivers, configures the network,  and creates an initial configuration in a directory ‘.crc’ (on Linux).

You can check the configurable options of "crc" with:

 $ crc config view 

Since I plan to test OpenShift Service Mesh on CRC, I have changed the memory limit to 16 GB and added the path to the pull secret file:

$ crc config set memory 16384 
$ crc config set pull-secret-file path/to/pull-secret.txt 

Start CodeReady Containers with:

 $ crc start 

This will take a while and in the end, will give you instructions on how to access the cluster. 

Shell
 




x


 
1
INFO To access the cluster, first set up your environment by following 'crc oc-env' instructions
2
INFO Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'
3
INFO To login as an admin, run 'oc login -u kubeadmin -p db9Dr-J2csc-8oP78-9sbmf https://api.crc.testing:6443'
4
INFO
5
INFO You can now run 'crc console' and use these credentials to access the OpenShift web console


I found that you need to wait a few minutes after that because OpenShift isn’t totally started. Check with:

 $ crc status 

The output should look like:

Shell
 






If your cluster is up, access it using the link in the completion message or use:

 $ crc console 

The user is "kubeadmin" and the password has been printed in the completion message above. You will need to accept the self-signed certificates and then be presented with an OpenShift 4 Web Console:

OpenShift web console

There are some more commands that you probably need:

  1.  crc stop stops the OpenShift cluster
  2.  crc delete  completely deletes the cluster
  3.  eval $(crc oc-env)  correctly sets the environment for the "oc" CLI

I am really impressed with CodeReady Containers. They give you the full OpenShift 4 experience with the new Web Console and even include the OperatorHub catalog to get started with Operators.

Updates

New CRC versions come out about once per month. You don't need to install them but they offer the latest version of OpenShift at that time. Updating means you have to delete the old VM and create a new one. 

A very good place for current information is the CRC Github issues page here.

Topics:
cloud, code ready containers, container, installation, kubernetes, openshift, red hat

Published at DZone with permission of Harald Uebele . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}