OpenShift
Version Details
Ansible 2.6.1 Python 2.7.5 OpenShift 3.9 CentOS 7.5.1804
System Requirements
- For this cluster setup you will need the following VM or Hardware Requirements:
3x CentOS 7.5 VMs or Hosts 8 vCPUs 12-16 GB RAM 80 GB HDD space (custom partition — 8GB swap, 1GB /boot, rest for / partition) 1 NIC interface with static address and gateway configured
Prequisites
- Perform these steps on all 3 hosts
- Install the following pre-requirements:
yum -y install yum yum-utils wget git net-tools bind-utils iptables-services bridge-utils NetworkManager yum -y install ansible pyOpenSSL python python-yaml python-dbus python-cryptography python-lxml docker tesseract nano yum -y update
- Latest Ansible Version:
yum install epel-release yum install ansible
- Setup Docker pre-requirements:
systemctl enable docker systemctl start docker
- Add the IP address, hostname and FQDN of each node to /etc/hosts for each host
10.1.10.27 opshmaster Openshift01 10.1.10.28 opshnode1 Openshift02 10.1.10.29 opshnode2 Openshift03
- Run ssh-keygen, accept the default location of the key and do not set a password for the key.
- Run the following bash script:
for host in Openshift01 \ Openshift02 \ Openshift03; \ do ssh-copy-id -i ~/.ssh/id_rsa.pub $host; \ done
- Restart all 3 hosts
Ansible Configuration
nano /etc/ansible/hosts
# Create an OSEv3 group that contains the masters and nodes groups [OSEv3:children] masters nodes etcd # Set variables common for all OSEv3 hosts [OSEv3:vars] ansible_ssh_user=root openshift_deployment_type=origin openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}] #openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}] os_sdn_network_plugin_name=redhat/openshift-ovs-multitenant openshift_disable_check=memory_availability #openshift_release=v3.7 # host group for masters [masters] Openshift01 openshift_hostname=Openshift01 openshift_public_hostname=Openshift01 [etcd] Openshift01 # host group for nodes, includes region info [nodes] Openshift01 openshift_node_labels="{'region': 'infra', 'zone': 'default'}" openshift_hostname=Openshift01 openshift_public_hostname=Openshift01 Openshift02 openshift_node_labels="{'region': 'primary', 'zone': 'east'}" openshift_hostname=Openshift02 openshift_public_hostname=Openshift02 Openshift03 openshift_node_labels="{'region': 'primary', 'zone': 'west'}" openshift_hostname=Openshift03 openshift_public_hostname=Openshift03
- If parsing of this file fails, change the Quotes & Double Quotes symbols.
OpenShift Installation
Download the Files:
git clone --single-branch -b release-3.9 https://github.com/openshift/openshift-ansible
Install Prerequisites:
ansible-playbook -i /etc/ansible/hosts openshift-ansible/playbooks/prerequisites.yml
Install OpenShift:
ansible-playbook -i /etc/ansible/hosts openshift-ansible/playbooks/deploy_cluster.yml
You should see similar output once done:
PLAY RECAP ***************************************************************************************************** Openshift01 : ok=619 changed=251 unreachable=0 failed=0 Openshift02 : ok=134 changed=53 unreachable=0 failed=0 Openshift03 : ok=134 changed=53 unreachable=0 failed=0 localhost : ok=12 changed=0 unreachable=0 failed=0 INSTALLER STATUS *********************************************************************************************** Initialization : Complete (0:00:48) Health Check : Complete (0:01:23) etcd Install : Complete (0:01:37) Master Install : Complete (0:05:13) Master Additional Install : Complete (0:00:49) Node Install : Complete (0:07:34) Hosted Install : Complete (0:03:42) Web Console Install : Complete (0:01:04) Service Catalog Install : Complete (0:07:04)
Verification
- On Master:
oc get nodes
NAME STATUS ROLES AGE VERSION openshift01 Ready master 18m v1.9.1+a0ce1bc657 openshift02 Ready compute 18m v1.9.1+a0ce1bc657 openshift03 Ready compute 18m v1.9.1+a0ce1bc657
oc get pods
NAME READY STATUS RESTARTS AGE docker-registry-1-m8hgb 1/1 Running 0 13m registry-console-1-zxpqh 1/1 Running 0 9m router-1-vwl99 1/1 Running 0 13m
Disable Kube-Proxy
- References
{{#widget:DISQUS
|id=networkm
|uniqid=OpenShift
|url=https://aman.awiki.org/wiki/OpenShift
}}