DEV Community

Cover image for How to run OpenShift 4 on your notebook
Harald Uebele
Harald Uebele

Posted on

How to run OpenShift 4 on your notebook

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 and this allows to run OpenShift 4.3 in a single node configuration on your
workstation. For free! It operates almost exactly like Minishift and Minikube. Actually under the covers it is 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 (IMHO 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 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.

First step is to setup CodeReady Containers:

$ crc setup

This checks the prerequistes, 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 (= Istio) 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 give you instructions on how to access the cluster.

INFO To access the cluster, first set up your environment by following 'crc oc-env' instructions
INFO Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'
INFO To login as an admin, run 'oc login -u kubeadmin -p db9Dr-J2csc-8oP78-9sbmf https://api.crc.testing:6443'
INFO
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
is some times not completely started. Check with:

$ crc status

Output should look like:

CRC VM: Running 
OpenShift: Running (v4.3.1) 
Disk Usage: 22.28GB of 32.72GB (Inside the CRC VM) 
Cache Usage: 12.3GB 
Cache Directory: /home/uebele/.crc/cache

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

$ crc console

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:

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. It gives you the full
OpenShift 4 experience with the new Web Console and even includes 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 to delete the old VM and create a new one.

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

Top comments (3)

Collapse
 
arturoaviles profile image
Arturo Avilés • Edited

Thanks for this article Harald! I'll try CRC 👨🏻‍💻

Important note for Ubuntu users (March 12, 2020):

"crc does not have any ubuntu support at all at the moment (not even "ubuntu awareness" to avoid trying to do too much on ubuntu), so it's not all surprising that it might be harmful when run on ubuntu :("
By: @cfergeau
Link: github.com/code-ready/crc/issues/1...

Please review Ubuntu instructions first, I have been dealing with problems to connect to the internet (DNS) and also when trying to run Docker containers ("no route to host") :(

Collapse
 
harald_u profile image
Harald Uebele

The Ubuntu situation is not good. I run Fedora on my work notebook, CRC is perfect (of course!). On my private notebook I run Linux Mint (which is based on Ubuntu) and I cannot get it to work. I am not a "networking, make DNS resolution work in different ways" expert and I fear that with all the required changes I have no network left. I am sure this will change!

Collapse
 
jmalyik profile image
magic

Good article. A good question: It is possible to run minikube and openshift crc on the same machine?