Step-by-Step Guide to Installing an OpenShift 3.11 Cluster on CentOS Virtual Machines
This guide walks through preparing three CentOS 7.6 VMs as combined master‑node hosts, configuring password‑less SSH, updating the OS, installing Ansible, importing required Docker images, setting up the Ansible inventory, deploying the OpenShift 3.11 cluster, creating an admin account, and troubleshooting common issues.
1. Pre‑installation Preparation
1.1 Host Allocation
The experiment uses three virtual machines, each acting as both a node and a master. The following table defines host names, IP addresses, OS version, and resource allocation.
Host Name
IP Address
OS Version
Resources
node01.example.com
192.168.0.21
CentOS 7.6
1C4G
node02.example.com
192.168.0.32
CentOS 7.6
1C4G
node03.example.com
192.168.0.43
CentOS 7.6
1C4G
Add the above entries to /etc/hosts :
192.168.0.21 node01.example.com
192.168.0.32 node02.example.com
192.168.0.43 node03.example.com1.2 SSH Password‑less Authentication
Generate an SSH key on the control node and copy it to the other hosts so that node01 can log in without a password. Run the following on each node if you want all machines to be password‑less.
ssh-keygen # generate key, press Enter for all prompts
ssh-copy-id node01.example.com # type "yes" and enter password
ssh-copy-id node02.example.com
ssh-copy-id node03.example.com1.3 Update OS Components
Upgrade the CentOS 7.3 image to the latest 7.6 release and install required utilities.
yum update -y
yum install wget git net-tools bind-utils yum-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct -y
reboot1.4 Obtain Installation Scripts
Install Ansible 2.7 from the EPEL repository (2.4 is not compatible), then clone the OpenShift Ansible playbooks and checkout the 3.11 release branch.
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.111.5 Import Required Docker Images
List of images needed for the OpenShift 3.11 cluster (excerpt):
[root@node01 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/openshift/origin-node v3.11.0 556a4e6d52cb 44 hours ago 1.17 GB
... (additional images omitted for brevity) ...Load the previously saved image tarballs:
docker load -i *.tar.gz2. Start Cluster Installation
2.1 Prepare the Ansible Hosts File
[root@master ~]# cat /etc/ansible/hosts
[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 cluster deployment2.3 Verify Deployment
Create an administrator account and grant cluster‑admin role:
htpasswd -b /etc/origin/master/htpasswd admin admin
oc login -u system:admin
oc adm policy add-cluster-role-to-user cluster-admin adminAfter successful login, the OpenShift web console is accessible (screenshots omitted).
FAQ
1. Monitoring installation fails
The monitoring pod reports 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.2If nodes lack the required label, scheduling fails. Apply the label to all nodes:
oc label node node01.example.com node-role.kubernetes.io/infra=true2. Web‑console deployment error
Similar to the monitoring issue, missing node labels cause scheduling failures. Add the master label:
oc label node node01.example.com node-role.kubernetes.io/master=true3. service‑catalog pod fails
The pod reports liveness probe failures. Deleting and recreating the pod resolves the problem.
4. Export images
Save image names to images.txt and export each as a tarball:
[root@node01 ~]# docker images | awk '{print $1":"$2}'
# (output list of REPOSITORY:TAG) for image in `cat images.txt`
do
zipname=`echo ${image} | awk -F / '{print $3}'`
docker save ${image} > images/${zipname}.tar.gz
done5. Metrics deployment error
The Ansible task fails because the passlib Python library is missing. Install it with pip and rerun the metrics playbook:
pip install passlib
ansible-playbook openshift-ansible/playbooks/openshift-metrics/config.ymlDevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.