本篇將介紹透過 OpenShift Ansible 來快速部署 RedHat OpenShift 社區版本 OKD (The Origin Community Distribution of Kubernetes) 的 release-3.11 版本,此篇文章主要是用來筆記學習裸機機器(Bare-metal Server)部署過程與環境架構。
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:YWid3TtIfGyFM8MsaZf1YYp9RcgC60plBJrhPNqEEDk root@basion.paas.domain.tw The key's randomart image is: +---[RSA 2048]----+ | oo . ..o= =o=o| | E. + * =++&.=.o| | .. X =.B+=B ..| | = o * + .. | | . . S o o | | . . . | | . | | | | | +----[SHA256]-----+
... ...
1 2 3 4 5 6 7 8 9 10 11 12
$for seq in {1..5}; do ssh-copy-id root@paas0$seq.paas.domain.tw; \ echo paas0$seq;\ done
#test ssh connection
$for seq in {1..5}; do ssh root@paas0$seq.paas.domain.tw echo paas0$seq; \ done
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
---
$for seq in {1..5}; do ssh root@paas0$seq.paas.domain.tw sestatus; \ echo paas0$seq;\ done
配置 DNS 設定
此次實驗請於 Domain 提供平台,設置「區域檔紀錄」類型 A 配置每個節點如下配置:
IP Address
Hostname
Type
TTL
192.168.101.130
paas01.paas.domain.tw
A
3600
192.168.101.131
paas02.paas.domain.tw
A
3600
192.168.101.132
paas03.paas.domain.tw
A
3600
192.168.101.133
paas04.paas.domain.tw
A
3600
192.168.101.134
paas05.paas.domain.tw
A
3600
192.168.101.131
*.apps.paas.domain.tw
A
3600
192.168.101.130
webconsole.paas.domain.tw
A
3600
remark: 部分DNS service 有提供設定wildcard domain 的服務,如果沒有提供的話,建議之後在上面透過Route 進出的apps,可以透過正向表列方式將domain指向 infra node
安裝依賴套件 (Install dependency packages)
1 2 3 4 5
$for seq in {1..5}; do ssh root@paas0$seq.paas.domain.tw yum install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct bash-completion.noarch bash-completion-extras.noarch python-passlib NetworkManager -y echo paas0$seq;\ done
安裝 Docker (Install docker)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
$for seq in {1..5}; do ssh root@paas0$seq.paas.domain.tw yum install docker-1.13.1 -y; ssh root@paas0$seq.paas.domain.tw echo pupaas0$seq done; done
#reate an OSEv3 group that contains the masters and nodes groups [OSEv3:children] masters nodes etcd # # # Set variables common for all OSEv3 hosts [OSEv3:vars] ## openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability,package_version ## # SSH user, this user should allow ssh based auth without requiring a password ansible_ssh_user=root