CentOS 7
Sponsored Link

OpenShift Origin (OKD) 3.10 : Install2018/08/22

 
Install OpenShift Origin which is the Open Source implementation of Red Hat OpenShift.
(The project name [OpenShift Origin] is changed to [OKD] from this version 3.10)
This example is based on the environment like follows.
-----------+-----------------------------------------------------------+------------
           |10.0.0.25                    |10.0.0.51                    |10.0.0.52
+----------+-----------+      +----------+-----------+      +----------+-----------+
|  [ ctrl.srv.world ]  |      | [ node01.srv.world ] |      | [ node02.srv.world ] |
|     (Master Node)    |      |    (Compute Node)    |      |    (Compute Node)    |
|     (Infra Node)     |      |                      |      |                      |
|     (Compute Node)   |      |                      |      |                      |
+----------------------+      +----------------------+      +----------------------+

 
There are some System requirements to configure cluster.
* Master node has up to 16G memory and up to 4 vCPU.
* Compute node has up to 8G memory and up to 1 vCPU.
* On all nodes, base OS is RHEL(CentOS) 7.4 or later (this example is based on CentOS 7.5).
[1] On All Nodes, Create a user for installation to be used in Ansible and also grant root privileges to him.
[root@ctrl ~]#
useradd origin

[root@ctrl ~]#
passwd origin

[root@ctrl ~]#
echo -e 'Defaults:origin !requiretty\norigin ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/openshift

[root@ctrl ~]#
chmod 440 /etc/sudoers.d/openshift

# if Firewalld is running, allow SSH

[root@ctrl ~]#
firewall-cmd --add-service=ssh --permanent

[root@ctrl ~]#
firewall-cmd --reload

[2] On All Nodes, install OpenShift Origin 3.10 repository and Docker and so on.
[root@ctrl ~]#
yum -y install centos-release-openshift-origin310 epel-release docker git pyOpenSSL
[root@ctrl ~]#
systemctl start docker

[root@ctrl ~]#
systemctl enable docker

[3] On Master Node, login with a user created above and set SSH keypair with no pass-phrase.
[origin@ctrl ~]$
ssh-keygen -q -N ""

Enter file in which to save the key (/home/origin/.ssh/id_rsa):
[origin@ctrl ~]$
vi ~/.ssh/config
# create new ( define each node )

Host ctrl
    Hostname ctrl.srv.world
    User origin
Host node01
    Hostname node01.srv.world
    User origin
Host node02
    Hostname node02.srv.world
    User origin

[origin@ctrl ~]$
chmod 600 ~/.ssh/config
# transfer public-key to other nodes

[origin@ctrl ~]$
ssh-copy-id node01

origin@node01.srv.world's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'node01'"
and check to make sure that only the key(s) you wanted were added.

[origin@ctrl ~]$
ssh-copy-id node02

[origin@ctrl ~]$
ssh-copy-id ctrl

[4] On Master Node, login with a user created above and run Ansible Playbook for setting up OpenShift Cluster.
[origin@ctrl ~]$
sudo yum -y install openshift-ansible
[origin@ctrl ~]$
sudo vi /etc/ansible/hosts
# add follows to the end

[OSEv3:children]
masters
nodes
etcd

[OSEv3:vars]
# admin user created in previous section
ansible_ssh_user=origin
ansible_become=true
openshift_deployment_type=origin

# use HTPasswd for authentication
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
# define default sub-domain for Master node
openshift_master_default_subdomain=apps.srv.world
# allow unencrypted connection within cluster
openshift_docker_insecure_registries=172.30.0.0/16

[masters]
ctrl.srv.world openshift_schedulable=true containerized=false

[etcd]
ctrl.srv.world

[nodes]
# defined values for [openshift_node_group_name] in the file below
# [/usr/share/ansible/openshift-ansible/roles/openshift_facts/defaults/main.yml]
ctrl.srv.world openshift_node_group_name='node-config-master-infra'
node01.srv.world openshift_node_group_name='node-config-compute'
node02.srv.world openshift_node_group_name='node-config-compute'

# if you'd like to separate Master node feature and Infra node feature, set like follows
# ctrl.srv.world openshift_node_group_name='node-config-master'
# node01.srv.world openshift_node_group_name='node-config-compute'
# node02.srv.world openshift_node_group_name='node-config-infra'

# run Prerequisites Playbook

[origin@ctrl ~]$
ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/prerequisites.yml


................
................

PLAY RECAP *********************************************************************
ctrl.srv.world             : ok=90   changed=21   unreachable=0    failed=0
localhost                  : ok=11   changed=0    unreachable=0    failed=0
node01.srv.world           : ok=65   changed=20   unreachable=0    failed=0
node02.srv.world           : ok=65   changed=20   unreachable=0    failed=0


INSTALLER STATUS ***************************************************************
Initialization  : Complete (0:01:19)

# run Deploy Cluster Playbook

[origin@ctrl ~]$
ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.yml


................
................

PLAY RECAP *********************************************************************
ctrl.srv.world             : ok=620  changed=274  unreachable=0    failed=0
localhost                  : ok=12   changed=0    unreachable=0    failed=0
node01.srv.world           : ok=119  changed=57   unreachable=0    failed=0
node02.srv.world           : ok=119  changed=57   unreachable=0    failed=0


INSTALLER STATUS ***************************************************************
Initialization              : Complete (0:00:39)
Health Check                : Complete (0:00:55)
Node Bootstrap Preparation  : Complete (0:06:27)
etcd Install                : Complete (0:01:13)
Master Install              : Complete (0:05:25)
Master Additional Install   : Complete (0:01:07)
Node Join                   : Complete (0:00:18)
Hosted Install              : Complete (0:01:13)
Web Console Install         : Complete (0:00:39)
Service Catalog Install     : Complete (0:02:24)

# show state

[origin@ctrl ~]$
oc get nodes

NAME               STATUS    ROLES          AGE       VERSION
ctrl.srv.world     Ready     infra,master   9m        v1.10.0+b81c8f8
node01.srv.world   Ready     compute        5m        v1.10.0+b81c8f8
node02.srv.world   Ready     compute        5m        v1.10.0+b81c8f8

# show state with labels

[origin@ctrl ~]$
oc get nodes --show-labels=true

NAME               STATUS    ROLES          AGE       VERSION           LABELS
ctrl.srv.world     Ready     infra,master   9m        v1.10.0+b81c8f8   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=ctrl.srv.world,node-role.kubernetes.io/infra=true,node-role.kubernetes.io/master=true
node01.srv.world   Ready     compute        5m        v1.10.0+b81c8f8   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=node01.srv.world,node-role.kubernetes.io/compute=true
node02.srv.world   Ready     compute        5m        v1.10.0+b81c8f8   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=node02.srv.world,node-role.kubernetes.io/compute=true
Matched Content