Perhaps one of the challenges in learning about Red Hat OpenShift is having a good testing environment to understand the platform well, be able to deploy test applications, and be phesible with both the GUI and the command line. While a minimal cluster starting with OpenShift version 4 requires at least 6 nodes, there is an all-in-one system called Red Hat CodeReady Containers. It includes a minimum cluster of the latest OpenShift 4 version with a series of settings to work on a single virtual machine that we can deploy on our test servers, or even on your own laptop. Although it is a project aimed mainly at software developers, but that serves us perfectly, to learn how to configure and manage this platform.
What other differences exist?
- There is only one node, which acts as “master” and “worker” at a time. You’ll see a lot of “warning” messages, but it’s not a problem.
- Kubernetes Operators are disabled. Also monitoring to save resources.
- Cannot upgrade to new versions of OpenShift. Although this is not a problem because we can download and run the new versions of this virtual machine that Red Hat is publishing regularly.
- It is an environment that must be recreated from time to time. Red Hat recommends doing it once a month, but in our hands-on experience, every two or three days of use, it gets slower and slower and needs to be destroyed and recreated.
- As it runs inside a virtual machine, it may be up to us to make some additional network settings by hand.
What are the HW and SW requirements?
- Latest version of Red Hat or Centos 7.X or 8.X. We prefer Centos as the setup is faster.
- 4 virtual CPUs (vCPUs)
- 8GB RAM
- 35 GB of disk space.
If none of this is a problem for you, you
can download the
image here. Please note that you need a Red Hat developer account (free).
You will see that in addition to selecting the operating system (there is an image for each type of “Hypervisor”), there is also a “secret”, this is still a kind of key-license, which will ask us during the creation of the virtual environment. Don’t download iton, but write down the “pull secret” in a notebook or similar.
If we are deploying the environment on Red Hat Linux, we will need to run these two commands to install and activate the NetworkManager:
$ su -c ‘yum install NetworkManager’
$ su -c ‘sytemctl start NetowrkManager’
We will also add a non-administrator user with sudo permissions, essential for everything to work properly.
$ useradd crc
$ passwd crc
$ vi /etc/sudoers
Allow root to run any commands anywhere
root ALL(ALL) ALL
crc ALL(ALL) ALL
With this user, we’ll download Code Ready Containers and launch the environment configurator.
$ su – crc
$ cd /home/crc/
$ tar -xvf crc*.xz
$ mv crc-linux-1.xxx-amd64/* /home/crc/bin/
$ crc setup
The latter is a necessary trick for DNS to work properly
$ crc start -n ‘8.8.8’
After a few minutes you should see this message.
To access the cluster, first set up your environment by following ‘crc oc-env’ instructions.
Then you can access it by running ‘oc login -u developer -p developer https://api.crc.testing:6443’.
To login as an admin, run ‘oc login -u kubeadmin -p dpDFV-xamBW-kKAk3-Fi6Lg https://api.crc.testing:6443‘.
You need to set up a number of environment variables with
$ eval $(crc oc-env)
Now you can register as an administrator:
$ oc login -u kubeadmin -p dpDFV-xamBW-kKAk3-Fi6Lg https://api.crc.testing:6443
.. or as a developer:
$ oc login -u developer -p developer https://api.crc.testing:6443
If you don’t have a graphical environment installed on this server, you won’t be able to access the web environment (via crc console),but you can use Firefox on any other system where you have Linux installed.
You need to copy the contents of /etc/hosts from the server where you installed OpenShift at the end of your local /etc/hosts file
Next you’ll need to open a VPN via ssh from a desktop environment like Ubuntu to the server where you deployed OpenShift
$ sudo apt-get install sshuttle
$ sudo sshuttle -r root@remote-server-ip -x remote-server-ip 0.0.0.0/0 -vv
And now, if you open your browser and access https://console-openshift-console. crc.testing you’ll see the GUI