OpenShift is Red Hat’s Cloud Computing Platform as a Service PaaS that offers several alternatives for developers to build, test and run applications quickly, simply and scalably.
OpenShift “takes care” of all the complexity related to infrastructure, middleware, and management, keeping the developer focused on application design and coding.
Currently the latest version is 4.x which really brought numerous facilities like Installer Provisioned Infrastructure (IPI), which makes it much easier for the most inexperienced. In this article we will focus on version 3.x because it is an already established version and has been widely used in the last 4 years.
Explaining some terms:
OpenShift Enterprise - Available only to customers who have purchased a Red Hat subscription. This version can be installed and configured on Amazon, Azure, or any company’s internal infrastructure.
OpenShift OKD - Available in the community where any / sysadmin developer can install and configure whether on Amazon, Azure or internal infrastructure, is not officially supported and is not offered any SLA.
OpenShift Online - Online version where the developer pays for “usage” (CPU, Memory, etc.). Interaction is performed through the command line.
OpenShift Dedicated - Version used by large companies that do not want to have the work of installing, configuring, upgrading, etc., leaving this task to the Red Hat engineering team.
Openshift Minishift - Version intended for local execution only. It is used by developers to observe application behavior prior to shipping to the Openshift cluster.
Using OpenShift you can quickly see the following advantages:
Self-service platform - Developers can create their own applications in different languages (Polyglot, multilanguage support) where resource utilization limits and quotas can be set for each project.
Scalable - You can scale to dozens of PODs in just a few minutes and this automatically.
Open Source / Choice of cloud - In addition to no lock-in vendor, you can deploy across multiple platforms with Amazon, Microsoft Azure, Google and even On-Premise.
OpenShift Platform Key Concepts
Containers - An instance running as a JBoss, Wordpress, Mysql, etc. application.
Pods - Set of one or more containers and management layers.
Nodes - RHEL/CentOS or CoreOS instance where the application is currently running.
Masters - RHEL/CentOS or CoreOS instance which aims to manage everything that happens in the cluster.
Briefly we can visualize the following flow:
- Applications are packaged in docker images;
- Applications are executed in containers and grouped in Pods;
- Pod / containers run on Nodes;
- Nodes are managed by the Master;
Installing Openshift OKD 3.11
As I said earlier, OpenShift can be installed on many platforms, so for this article’s tests we will use oVirt. oVirt is a free open-source virtualization platform.
As I want to show how to create a lab environment, I will not configure HA for the management layer (Master) but I will configure the “HA” of the application layer (Router) for learning purposes.
- The servers must have CentOS 7.7 installed
- DNS needs to be working. The servers need to talk to each other using “names”.
- An extra disk attached to the server.
I will use the following servers:
- master-01.mmagnani.lab - 10.0.0.80
- node-01.mmagnani.lab - 10.0.0.81
- node-02.mmagnani.lab - 10.0.0.82
- infra-01.mmagnani.lab - 10.0.0.83
- infra-02.mmagnani.lab - 10.0.0.84
- bastion.mmagnani.lab - 10.0.0.116
We will execute all commands from the “bastion.mmagnani.lab” server, as the name already says it will be our central execution point. The first step of course is to install Ansible and create our inventory so that commands can be executed on all nodes:
We now have access to execute commands on all nodes using Ansible. You can test by pinging:
Update all nodes, run:
Selinux must be enforcing on all nodes, run:
Firewalld in this case must be disabled on all nodes, run:
Install EPEL repo on all nodes, run:
Install the following packages on all nodes:
On all nodes there is a disk “/dev/sdb” that will be used by the docker:
Now clone the openshift-ansible repository:
[root@bastion ~]# pwd /root/workspace/okd [root@bastion ~]# git clone https://github.com/openshift/openshift-ansible.git [root@bastion ~]# cd openshift-ansible [root@bastion ~]# git checkout release-3.11
Now one of the most important steps. Configure “/etc/ansible/hosts” that defines how Openshift will be installed:
If you want to know in detail about each parameter, check the documentation: Openshift Doc
Now create the entries for DNS, this is very important.
For the parameter “openshift_master_default_subdomain=cloudapps.mmagnani.lab, should be creating a “wildcard” pointing to where the routers will be deployed, which in this case will be infra-01 and infra-02.
- “*.cloudapps - 10.0.0.83 and 10.0.0.84”
Now you are probably ready to begin the installation of Openshift. Run the “prerequisites” playbook:
If all went well, run the installation playbook:
In the end you should see something like:
Make sure all nodes are in “Ready” status:
Openshift OKD has been successfully installed! In the next part we will look at how to add persistence and check the health of key components.