OpenShift 3.11 Installation on a CentOS 7 Multi-Node Cluster
Let's get container management with OpenShift configured and running on CentOS multi-node clusters.
Join the DZone community and get the full member experience.
Join For FreeOpenShift is a container management platform (PaaS) built around Docker containers orchestrated and managed by Kubernetes on a foundation of Red Hat Enterprise Linux
AWS CentOS instances are provisioned to do this setup, but it's not the only option. You can install OpenShift on-premises as well, but you need to ensure that you have internet access to those instances.
If you are trying to install OpenShift within an organization and servers are running behind a firewall/proxy server, you need to contact your network administrator to give internet access for this setup.
Prerequisites
Note: The following approach is not recommended in a production environment.
Provision the needed number of nodes of CentOS Linux. In this example, I created 3 CentOS nodes on AWS.
By default, you can't log in on AWS CentOS via 'root' user, so you need to make some changes to be able to login on CentOS with a 'root' user account.
To enable root access on an AWS CentOS instance, open /etc/ssh/sshd_config file and uncomment these settings in the file as given below:
# Login with centos user and run these commands.
$ sudo vi /etc/ssh/sshd_config
PermitRootLogin yes #Uncomment this line in /etc/ssh/sshd_config and save it.
$ sudo systemctl restart sshd
Now copy the centos user's authorized_keys to root's authorized_keys.
$ sudo -s
$ cp /home/centos/.ssh/authorized_keys /root/.ssh/authorized_keys
Now you are ready to log in as a root user with the same private keys that you used for the centos user. Similarly, enable root access on each node that will be part of your OpenShift cluster.
The following ports are required to be opened for OpenShift clusters to establish communication among nodes.
Ports |
Protocol |
22 |
TCP |
53 or 8053 |
TCP / UDP |
80 or 443 |
TCP |
1936 |
TCP |
4001 |
TCP |
2379 and 2380 |
TCP |
4789 |
UDP |
8443 |
TCP |
10250 |
TCP |
OpenShift Installation
There are multiple ways to install Openshift clusters, but I am going to use Ansible tools and a shell script to install Openshift 3.11 on my CentOS 7 instances.
To get more detail on ports for OpenShift, refer to this link.
Install git on the master node and clone the repository.
$ yum install -y git
$ git clone https://github.com/arunvdsharma/openshift-centos.git
$ cd openshift-centos
Note: If there is an error related to "bad characters" while running any script command, execute the sed command to remove the bad characters, for example:
$ sed -i -e 's/\r$//' install-tools.sh
Update "Domain Name" in the Inventory File
You may want to configure a new domain name. If so, you can replace it. In my case, the domain name I used is aruntechhub.xyz, which I have procured on a DNS provider.
"There are multiple inventory files in the repository e.g. inventory-3nodes.ini. You can choose one, customize it according to your needs, and rename it with inventory.ini. The same inventory file will be used to install the OpenShift cluster."
Replace your domain name with the following properties in the inventory file:
openshift_public_hostname=console.your_domain_name
openshift_master_default_subdomain=apps.your_domain_name
Once you have made the necessary changes to your inventory.ini file, you are all set to install OpenShift. Don't forget to give executable permission to the install-tools.sh file, if it hasn't already been given. This file installs all the prerequisites to initiate OpenShift 3.11 installation on CentOS.
Note: Ensure that you are logged in via root user.
$ chmod +x install-tools.sh
$ ./install-tools.sh
Install Prerequisites on Other Nodes
Remember to perform the above steps on other cluster nodes and copy install-tools.sh from the master to te other nodes so you can run install prerequisites on every node.
#To ssh from one node to another using .pem file
$ scp -i keypair.pem install-tools.sh root@host_ip:~/
$ ssh -i Openshift-keypair.pem root@host_ip
$ ./install-tools.sh
Once all the changes are done, you are all set to install OpenShift now. Run the following commands on the master node:
$ chmod +x install-openshift.sh
$ ./install-openshift.sh
If all the Ansible jobs are successful, you can access the OpenShift dashboard via https://console.your_domain_name.
Please provide your comments or suggestions, if any.
Opinions expressed by DZone contributors are their own.
Comments