OpenShift Origin (OKD) 3.11 : Install2018/11/20 |
Install OpenShift Origin which is the Open Source implementation of Red Hat OpenShift.
(The project name [OpenShift Origin] is changed to [OKD] from previous 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.11 repository and Docker and so on. For Ansible, Ansible Version 2.6, 2.7, 2.8, 2.9 are provided from CentOS Repository, but Openshift-Ansible is not supported on 2.8 or later, so Install Ansible 2.7. |
[root@ctrl ~]#
[root@ctrl ~]# yum -y install centos-release-openshift-origin311 centos-release-ansible-27 [root@ctrl ~]# yum -y install ansible openshift-ansible docker git pyOpenSSL systemctl enable --now 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. |
# 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=83 changed=21 unreachable=0 failed=0 localhost : ok=11 changed=0 unreachable=0 failed=0 node01.srv.world : ok=58 changed=20 unreachable=0 failed=0 node02.srv.world : ok=58 changed=20 unreachable=0 failed=0 INSTALLER STATUS *************************************************************** Initialization : Complete (0:03:23) # run Deploy Cluster Playbook [origin@ctrl ~]$ ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.yml ................ ................ PLAY RECAP ********************************************************************* ctrl.srv.world : ok=711 changed=322 unreachable=0 failed=0 localhost : ok=11 changed=0 unreachable=0 failed=0 node01.srv.world : ok=119 changed=63 unreachable=0 failed=0 node02.srv.world : ok=119 changed=63 unreachable=0 failed=0 INSTALLER STATUS *************************************************************** Initialization : Complete (0:00:25) Health Check : Complete (0:00:53) Node Bootstrap Preparation : Complete (0:02:23) etcd Install : Complete (0:00:54) Master Install : Complete (0:04:44) Master Additional Install : Complete (0:00:36) Node Join : Complete (0:00:13) Hosted Install : Complete (0:00:54) Cluster Monitoring Operator : Complete (0:01:18) Web Console Install : Complete (0:00:55) Console Install : Complete (0:00:30) metrics-server Install : Complete (0:00:01) 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 12m v1.11.0+d4cacc0 node01.srv.world Ready compute 9m v1.11.0+d4cacc0 node02.srv.world Ready compute 9m v1.11.0+d4cacc0 # show state with labels [origin@ctrl ~]$ oc get nodes --show-labels=true NAME STATUS ROLES AGE VERSION LABELS ctrl.srv.world Ready infra,master 12m v1.11.0+d4cacc0 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 9m v1.11.0+d4cacc0 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 9m v1.11.0+d4cacc0 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=node02.srv.world,node-role.kubernetes.io/compute=true |
Sponsored Link |