Operations 10 min read

Step-by-Step Guide to Installing an OpenShift 3.11 Cluster on CentOS VMs

This guide details the preparation, configuration, and deployment steps for setting up an OpenShift 3.11 cluster on three CentOS 7.6 virtual machines, covering host mapping, SSH key setup, OS updates, image loading, Ansible playbooks, and troubleshooting common issues.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Step-by-Step Guide to Installing an OpenShift 3.11 Cluster on CentOS VMs

The experiment uses three virtual machines, each acting as both a node and a master. The most frequent issue encountered was image download problems.

1. Pre‑installation Preparation

1.1 Host Allocation

Add the following host entries to /etc/hosts :

192.168.0.21 node01.example.com
192.168.0.32 node02.example.com
192.168.0.43 node03.example.com

1.2 SSH Password‑less Authentication

Configure node01 to SSH into the other machines without a password. Run the commands on each node if you need full password‑less access.

ssh-keygen  # generate key, press Enter for defaults
ssh-copy-id node01.example.com   # type yes, then password
ssh-copy-id node02.example.com   # type yes, then password
ssh-copy-id node03.example.com   # type yes, then password

1.3 Update OS Packages

Upgrade the CentOS 7.3 image to the latest 7.6 version:

yum update -y
yum install wget git net-tools bind-utils yum-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct -y
reboot

1.4 Obtain Installation Scripts

Install Ansible 2.7 (the 2.4 version does not work) and clone the OpenShift playbooks:

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/epel.repo
yum -y --enablerepo=epel install ansible pyOpenSSL

git clone https://github.com/openshift/openshift-ansible
cd openshift-ansible
git checkout release-3.11

1.5 Import Required Docker Images

List of necessary images (example output of docker images ) is provided. Load the image tarballs:

docker load -i *.tar.gz

2. Start Cluster Installation

2.1 Prepare the Ansible hosts file

[OSEv3:children]
masters
nodes
etcd

[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=origin
openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability
openshift_master_identity_providers=[{'name':'htpasswd_auth','login':'true','challenge':'true','kind':'HTPasswdPasswordIdentityProvider',}]
os_firewall_use_firewalld=true

[masters]
node01.example.com
node02.example.com
node03.example.com

[etcd]
node01.example.com
node02.example.com
node03.example.com

[nodes]
node01.example.com openshift_node_group_name='node-config-master'
node01.example.com openshift_node_group_name='node-config-compute'
node02.example.com openshift_node_group_name='node-config-master'
node02.example.com openshift_node_group_name='node-config-compute'
node03.example.com openshift_node_group_name='node-config-master'
node03.example.com openshift_node_group_name='node-config-compute'

2.2 Deploy the Cluster

ansible-playbook openshift-ansible/playbooks/prerequisites.yml   # pre‑install checks
ansible-playbook openshift-ansible/playbooks/deploy_cluster.yml   # actual deployment

2.3 Post‑Installation Tests

Create an admin account and log in:

htpasswd -b /etc/origin/master/htpasswd admin admin
oc login -u system:admin
oc adm policy add-cluster-role-to-user cluster-admin admin

After logging in, you can access the OpenShift web console (screenshots omitted).

FAQ

1. Monitoring installation fails

The monitoring pod shows an image pull error for prometheus-operator:v0.23.2 . Pull and retag the image manually:

docker pull tripleorocky/coreos-prometheus-operator:v0.23.2

docker tag tripleorocky/coreos-prometheus-operator:v0.23.2 quay.io/coreos/prometheus-operator:v0.23.2

Also ensure the required node label is set:

oc label node node01.example.com node-role.kubernetes.io/infra=true

2. Web‑console deployment error

This is also a label issue; apply the master label:

oc label node node01.example.com node-role.kubernetes.io/master=true

3. service‑catalog failure

Delete and recreate the failing pod to resolve liveness probe timeouts.

4. Export images

Save image names to images.txt and export them as tar.gz files:

docker images | awk '{print $1":"$2}' > images.txt

for image in `cat images.txt`; do
    zipname=`echo ${image} | awk -F / '{print $3}'`
    docker save ${image} > images/${zipname}.tar.gz
done

5. Metrics deployment error

The metrics role fails because the Python passlib library is missing. Install it and rerun the playbook:

pip install passlib
ansible-playbook openshift-ansible/playbooks/openshift-metrics/config.yml
operationsKubernetesCentOSAnsibleOpenShiftCluster Installation
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.