How to install OpenShift Origin on CentOS-7

OpenShift Origin When I try to build a OpenShift Origin cluster, I noticed that it’s a bit hard to have an intimate knowledge of its installation. This post focused on this topic, and describes how to use openshift-ansible to install an Origin cluster on several servers.

Step One: Prepare for the working nodes

I use 4 VM nodes for the cluster, each node has 4GB ram 80GB disk space. The four VMs are arranged like this,

Etcd is installed on the 3 nodes. The storage for Openshift is local disk. If you would like to use Ceph or something else instead, please check the document for details, it’s not covered by this post.

Step Two: Prepare Ansible playbook recipes

The whole installation of Openshift is by ansible playbook, and I run sensible on my laptop. Since we would run ansible from a laptop, make sure we can login all the above servers with proper system accounts. I use root for simple.

On you laptop, check out the source code of openshift-ansible with git,

git clone
cd openshift-ansible
cp ./inventory/byo/hosts.origin.example ./inventory/byo/hosts

Then edit ./inventory/byo/hosts, to make sure it has the expected settings as we mentioned above. Here is my config,

$ cat ./inventory/byo/hosts | grep -v ^# | grep -v ^$
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
[lb] containerized=false
nl-node-[1:3] openshift_node_labels="{'region': 'primary', 'zone': 'default'}

Step 3: Fire the installation with ansible-playbook

This is kinda the last step. With the help of openshift-ansible, the installation is really simple and smooth. Run this command on your laptop as normal user,

$ ansible-playbook -i ./inventory/byo/hosts playbooks/byo/config.yml

After several minutes (typically 10 mins), you’d see the final outputs like these,

TASK [cockpit-ui : set_fact] ***************************************************
ok: []

TASK [cockpit-ui : Copy the admin client config(s)] ****************************
ok: []

TASK [cockpit-ui : Deploy registry-console] ************************************
changed: []

TASK [cockpit-ui : Delete temp directory] **************************************
ok: []

PLAY RECAP *********************************************************************
localhost : ok=11 changed=0 unreachable=0 failed=0 : ok=280 changed=59 unreachable=0 failed=0 : ok=247 changed=50 unreachable=0 failed=0 : ok=247 changed=50 unreachable=0 failed=0 : ok=486 changed=95 unreachable=0 failed=0

This means the installation finished all well.

Tips: If there are any errors occurred during the installation, you may check the recipe files, or just leave me a comments. It’s recommended to uninstall the whole environment before your re-installation, as we need to make sure all the configuration are unified. The uninstallation is as simple as the installation, just run this command,

ansible-playbook -i ./inventory/byo/hosts playbooks/adhoc/uninstall.yml

Step 4: Prepare Openshift accounts and start your journey

As I cannot find any default accounts for Openshift, I created a new account. With below commands, we created a new account “admin” with password “system”, with cluster admin (super admin) privileges.

htpasswd -b /etc/origin/master/htpasswd system admin
openshift admin policy add-cluster-role-to-user cluster-admin admin

The open with Chrome (Chrome is the best) to start your Openshift Journey 🙂

Other Tips:

  • Don’t use docker packages that come from Docker official site, since it’s not supported well by ansible playbook roles.
  • Make sure the hostname on each node match its domain name, in case of any errors (I’m using /etc/hosts to define domain names, which is not a good idea).
  • If the installation progress cannot finish smoothly, you can uninstall the cluster, and re-run the installation.
Share Button

Leave a comment

Your email address will not be published. Required fields are marked *