Skip to main content

Installing openshift on centos

Submitted by mcfish on Mon, 26/02/2018 - 09:31

This is mostly a memo for me on how to install OpenShift 3.7 to Centos 7.4 and not a definite guide. Your milage may vary :)


I'm building this OpenShift cluster on virtual machines, which are running on VMWare Fusion 8.5 . You can use physical machines, or virtualization software as long as it supports nested virtualization. Machines are installed with minimal software configuration and with the following vmware resources:

Master node:

  • 2 cpu cores
  • Two disks (50G + 25G)
  • 6G memory (To properly install OpenShift master, you need at least 16G, but we will skip this check)

Slave node:

  • 2 cpu cores
  • Two disks (40G + 25G)
  • 4G memory (To properly install OpenShift slave, you need at least 8G, but we will skip this check)

Note. Do not use the 25G disk during the install, leave it empty for now. And remember to enable nested virtualization on machines from cpu/memory configuration panel.

Preparing all nodes:

Install OS updates and latest packages:

yum update -y
yum install -y centos-release-openshift-origin
yum install -y wget git net-tools bind-utils iptables-services bridge-utils ntp docker

Create 'origin' user, which ansible will use to install OpenShift. These commands will also enable passwordless sudo for this user. Password is needed to install ssh keys, so don't skip setting that:

useradd origin
passwd origin
echo -e 'Defaults:origin !requiretty\norigin ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/openshift
chmod 440 /etc/sudoers.d/openshift

This document doesn't use proper DNS server (which you should be using), so we need to alter /etc/hosts file. Add these two lines, replacing x.x.x.x with the servers IP:

x.x.x.x master.osdemo.local
x.x.x.x node01.osdemo.local

Now we will create partition on the 25G disk, which you hopefully left untouched during installation. These commands will also enable + start docker, and set storage to this 25G disk.

cfdisk /dev/sdb
( create new primary partition .. fill the whole disk, and set type to: 8e)

vgcreate origin /dev/sdb1
echo VG=origin >> /etc/sysconfig/docker-storage-setup

systemctl enable docker
systemctl start docker

Installing master:

Install OpenShift utils:

yum install -y atomic-openshift-utils

Edit /etc/ansible/hosts file, and add the content to the end of file:



openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/.htpasswd'}]

## Comment line below, if using recommended memory (16G for master, and 8G for slave node)

master.osdemo.local openshift_schedulable=true containerized=false


master.osdemo.local openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
node01.osdemo.local openshift_node_labels="{'region': 'primary', 'zone': 'east'}" openshift_schedulable=true

Now switch to origin user and create + distribute ssh keys:

su origin -l
ssh-keygen -q -N ""
ssh-copy-id origin@master.osdemo.local
ssh-copy-id origin@node01.osdemo.local

And finally.. Run the OpenShift installer:

ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/byo/config.yml

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.