By Anuj Tuli, Chief Technology Officer
Here are the steps to installing Red Hat OpenShift Container Platform from scratch, for your lab or dev environments. We will walk through setting up the OC cluster with 1 master and 1 node, but you can set up as many nodes as you’d like. Since we are not setting up the master nodes in HA configuration, we’d recommend this setup be limited to your lab environments.
This guide is valid for RHEL 7, and OSE 3.5.
We will set up Openshift Container Platform on VMware virtual machines. If you are using KVM or another hypervisor, the steps for hardware configurations may differ slightly.
First, let us take a look at the pre-requisite steps that need to be addressed before we begin our work.
This applies to both VMs (Master VM and Node VM):
- RHEL 7 VM with minimum/base packages
- A valid Subscription with RedHat with appropriate entitlements
- Static IP configuration set up
- /etc/hosts configured for name resolution on both servers
- SSH Keys copied on both servers (optional)
- Nameservers set up
- firewalld service disabled
- Yum enabled
- Non-root user set up for sudo access (optional)
- VMware tools package installed
- Both VMs set up with 40 GB of additional attached storage (i.e. separate volumes). It is an important step, as this volume will be used when setting up Docker storage.
Prepare and Install Packages (on Master and Nodes)
Since we set up RHEL with minimal packages, we would need to enable all the needed rpms.
First register with subscription manager using your Red Hat profile credentials.
subscription-manager register subscription-manager refresh subscription-manager attach –-auto subscription-manager repos –-list subscription-manager repos --enable rhel-7-server-rh-common-beta-rpms subscription-manager repos --enable rhel-7-server-rpms subscription-manager repos --enable rhel-7-server-source-rpms subscription-manager repos --enable rhel-7-server-rh-common-source-rpms subscription-manager repos --enable rhel-7-server-rh-common-debug-rpms subscription-manager repos --enable rhel-7-server-optional-source-rpms subscription-manager repos --enable rhel-7-server-extras-rpms
To enable OpenShift rpms, you will need to find the associated Pool ID and attach it separately.
subscription-manager list --available --all
Find the pool ID associated with the Red Hat OpenShift Container Platform, and run:
subscription-manager attach --pool <Pool ID>
You will now be able to enable the associated repos.
subscription-manager repos --enable rhel-7-server-ose-3.5-rpms subscription-manager repos --enable rhel-7-server-openstack-10-rpms
Optionally, if you want to set up OC Cluster in HA configuration:
subscription-manager repos --enable="rhel-ha-for-rhel-7-server-rpms"
Finish setting up other utils:
yum repolist yum -y update yum install wget git net-tools bind-utils iptables-services bridge-utils bash-completion yum install gcc python-virtualenv yum install atomic-openshift-utils
Set up dnsmasq (on Master and Nodes)
When using OpenShift SaaS offerings, the service provider takes care of setting up DNS and routing. But since we are setting up the cluster from the ground up, we need to set up these components manually. We will be using dnsmasq for our lab.
yum -y install dnsmasq bind-utils
We will now modify the /etc/dnsmasq.conf configuration file. It is recommended that you back up the existing conf file before modification, in case you need to revert to it later.
Modify the /etc/dnsmasq.conf file:
On the Master, add or modify the #address and the #resolv-file sections as follows:
address=/<subdomain.domain.com>/<master IP> resolv-file=/<path>/<custom-filename>
On each Node(s), add or modify the #address and the #resolv-file sections as follows:
This /<path>/<custom-filename> is where we will list our nameserver (in most cases, your subnet gateway) IP address.
On the Master, create the file
And add the line
On each Node(s), create the file
And add the line
We will also need to update the /etc/resolv.conf file and modify the existing nameserver entry to be a loopback address.
On the Master and Node(s), open the /etc/resolv.conf file and modify the nameserver entry
Note that if you reboot your VMs, you may need to update the nameserver entry in this file again.
On both the Master and the Node(s), we have disabled the firewall service already (as a pre-requisite). We will now enable the dnsmasq service:
systemctl enable dnsmasq && systemctl start dnsmasq
In order to make sure the dnsmasq service is working correctly, you can try to ping the <subdomain>.<domain> address you defined in the /etc/dnsmasq.conf file under the address section.
If you run this command on the Master, it should return the IP address of your Master server. You could also add another custom subdomain in front (any string), and it should return the same IP address. For example –
should return the IP of the Master server as well.
Configuring Docker (on Master and Nodes)
Our next step is to set up Docker on these machines.
yum -y install docker-1.12.6
We will be modifying the /etc/sysconfig/docker-storage-setup file. It is recommended that you back up the existing file before modification.
But first, we need to find out what our volume is named. If you recall, we had set up additional 40 GB volumes on our machines for use with Docker storage.
The output of fdisk –l will give you the name of your additional disk volume. In my case, it was /dev/sdb. We will use the sdb name in our docker-storage-setup file.
Open /etc/sysconfig/docker-storage-setup through your favorite editor, comment all existing lines, and add the following entries:
Save and close the file.
We will disable cluster locking configuration for LVM
And then run our Docker storage setup
You can verify the setup using the command
It will show you the attributes and sizes associated with the various volumes
We can now start the Docker service
systemctl enable docker && systemctl start docker
Openshift install (on Master)
We can now finally get started with the OpenShift install steps.
yum -y install atomic-openshift-docker-excluder atomic-openshift-excluder atomic-openshift-utils bridge-utils bind-utils git iptables-services net-tools wget
Once we have all the packages ready to go, we run
The setup asks a number of questions. After selecting a user that you’d like to enable for SSH access, you will be asked to select a variant for the install. We will select option  for OpenShift Container Platform, which is also the default.
You will be asked to enter the hostname or IP of your Master node, and choose whether the host will be RPM based or container based.
The installer will then provide a brief summary of the information entered, and will prompt for additional hosts. We will select y and this time we will enter the hostname or IP of our Node server. You can go through configuring additional Node servers in this section.
For the ‘New Default Subdomain’, you can configure the . information as you have defined it under the /etc/dnsmasq.conf file. This portion can be used later for external routing.
If you have any http or https proxies, you can configure them on the next screen.
The installer then shows a summary of all the information captured, and what the configuration would look like. Once you confirm all the shown configurations, the installer kicks off the setup. It can take a while for the install to complete.
Once the installation has completed successfully, you can verify the running services using the following command
systemctl status | grep openshift
The output of this command will list the services running on both master and node(s). If you run the same command on the node(s), it will only show the services running on that node.
You can also run some sample OC commands on the Master to make sure all looks good
oc get pods oc get projects oc get nodes
That should do it! You have now set up a single node OpenShift cluster in your lab environment.
The process of creating users depends upon which Identity Provider you would like to have set up with OpenShift.
You can access the OpenShift console via https://<Master_IP_or_FQDN>:8443/console
If you have any questions about the steps documented here, would like more information on the installation procedure, or have any feedback or requests, please let us know at firstname.lastname@example.org.
About the Author
|Anuj Tuli, Chief Technology Officer|
Anuj joined Keyva from Tech Data where he was the Director of Automation Solutions. In this role, he specializes in developing and delivering vendor-agnostic solutions that avoid the “rip-and-replace” of existing IT investments. Tuli has worked on Cloud Automation, DevOps, Cloud Readiness Assessments and Migrations projects for healthcare, banking, ISP, telecommunications, government and other sectors.
During his previous years at Avnet, Seamless Technologies, and other organizations, he held multiple roles in the Cloud and Automation areas. Most recently, he led the development and management of Cloud Automation IP (intellectual property) and related professional services. He holds certifications for AWS, VMware, HPE, BMC and ITIL, and offers a hands-on perspective on these technologies.
Like what you read? Follow Anuj on LinkedIn at https://www.linkedin.com/in/anujtuli/