OpenShift Origin 高級(jí)安裝部署指南

概述

根據(jù)官方文檔中的“高級(jí)安裝指南”的建議,如果想要搭建真正的滿足生產(chǎn)環(huán)境要求的 OpenShift 集群,我們需要借助配置管理工具 Ansible 來(lái)安裝 OpenShift 集群少态。本文所介紹的即為面向生產(chǎn)環(huán)境的高級(jí)安裝指南。

基礎(chǔ)設(shè)施配置清單

服務(wù)器需要三臺(tái):一臺(tái)主節(jié)點(diǎn)服務(wù)器,兩臺(tái)子節(jié)點(diǎn)服務(wù)器家厌,其中主節(jié)點(diǎn)服務(wù)器也會(huì)充當(dāng) NFS 文件共享存儲(chǔ)目錄和 etcd 數(shù)據(jù)持久化的服務(wù)器。

配置屬性 master node01 node02
CPU 邏輯內(nèi)核數(shù)量 4 4 4
內(nèi)存 16G 8G 8G
硬盤 300G 100G 100G
操作系統(tǒng) CentOS 7 CentOS 7 CentOS 7
hostname master.example.com node01.example.com node02.example.com
服務(wù)器 IP 192.168.123.155 192.168.123.156 192.168.123.158
root 用戶密碼 handhand handhand handhand
服務(wù)器角色 主控節(jié)點(diǎn)椎工,NFS 計(jì)算節(jié)點(diǎn)饭于,load balancer 計(jì)算節(jié)點(diǎn)

主要服務(wù)組件清單

組件名稱 版本/分支 安裝來(lái)源 安裝節(jié)點(diǎn) 備注
docker 1.12.6 yum 軟件倉(cāng)庫(kù) 所有節(jié)點(diǎn)
VMware Harbor 1.2.2 Github N/A 由 gzregistry 服務(wù)器提供注冊(cè)服務(wù)
ansible 2.4.0 yum epel 主節(jié)點(diǎn)
openshift-ansible release-3.6 Github 主節(jié)點(diǎn)
OpenShift Origin 3.6.1 openshift-ansible / yum 軟件倉(cāng)庫(kù) 主節(jié)點(diǎn)
etcd 3.1.9 openshift-ansible / yum 軟件倉(cāng)庫(kù) 主節(jié)點(diǎn) ?

關(guān)于 etcd 的版本問(wèn)題

根據(jù)安裝實(shí)測(cè),CentOS 軟件倉(cāng)庫(kù)提供的最新版本的 etcd 3.2.7 目前存在問(wèn)題维蒙,服務(wù)啟動(dòng)時(shí)報(bào)證書錯(cuò)誤掰吕,如下所示:

etcd started with error: transport: remote error: tls: bad certificate; please retry

所以目前我們?cè)?ansible 配置文件中認(rèn)為限定 etcd 的安裝版本為3.1.9

OpenShift 詳細(xì)安裝步驟

本章節(jié)將詳細(xì)介紹 OpenShift Origin 集群搭建的詳細(xì)過(guò)程。完整的安裝指南請(qǐng)?jiān)L問(wèn)官方鏈接:https://docs.openshift.org/latest/install_config/install/advanced_install.html

注意:以下列示的步驟需要在所有節(jié)點(diǎn)上實(shí)施颅痊。

為 CentOS 配置國(guó)內(nèi)鏡像源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum -y update && yum -y upgrade

添加 Host 映射

192.168.123.155 master.example.com master
192.168.123.155 nfs.example.com
192.168.123.156 lb.example.com
192.168.123.156 node01.example.com node01
192.168.123.158 node02.example.com node02

? 注意:以下步驟僅在“主節(jié)點(diǎn)”上實(shí)施殖熟。

配置 SSH 免密碼登陸

ssh-keygen -f ~/.ssh/id_rsa -N ''
for host in master.example.com node01.example.com node02.example.com
do
    ssh-copy-id -i ~/.ssh/id_rsa.pub $host;
done

安裝基礎(chǔ)軟件包

yum -y install docker git wget net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct

設(shè)置 Docker 為開機(jī)自啟動(dòng)并啟動(dòng) Docker 守護(hù)進(jìn)程

systemctl enable docker
systemctl start docker

移動(dòng) Docker 數(shù)據(jù)目錄至數(shù)據(jù)盤分區(qū) /u01

systemctl stop docker
mkdir -p /u01/var/lib
mv /var/lib/docker /u01/var/lib
ln -s /u01/var/lib/docker /var/lib/docker
systemctl start docker

安裝 Ansible

yum install -y epel-release
yum repolist
yum install -y ansible pyOpenSSL python-cryptography python-lxml

克隆倉(cāng)庫(kù) openshift-ansible 并切換至 release-3.6 分支

git clone -b release-3.6 https://github.com/openshift/openshift-ansible.git /usr/share/openshift-ansible

配置 ansible 庫(kù)存文件

編輯 /etc/ansible/hosts 文件并添加一下內(nèi)容:

# Create an OSEv3 group that contains the masters and nodes groups
[OSEv3:children]
masters
nodes
etcd
lb
# Set variables common for all OSEv3 hosts
[OSEv3:vars]
# SSH user, this user should allow ssh based auth without requiring a password
ansible_ssh_user=root
# If ansible_ssh_user is not root, ansible_become must be set to true
#ansible_become=true
openshift_deployment_type=origin
# Specify the generic release of OpenShift to install. This is used mainly just during installation, after which we
# rely on the version running on the first master. Works best for containerized installs where we can usually
# use this to lookup the latest exact version of the container images, which is the tag actually used to configure
# the cluster. For RPM installations we just verify the version detected in your configured repos matches this
# release.
openshift_release=v3.6
# Specify an exact container image tag to install or configure.
# WARNING: This value will be used for all hosts in containerized environments, even those that have another version installed.
# This could potentially trigger an upgrade and downtime, so be careful with modifying this value after the cluster is set up.
openshift_image_tag=v3.6.1
# Specify an exact rpm version to install or configure.
# WARNING: This value will be used for all hosts in RPM based environments, even those that have another version installed.
# This could potentially trigger an upgrade and downtime, so be careful with modifying this value after the cluster is set up.
openshift_pkg_version=-3.6.1
# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvider
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
# Default login account: admin / handhand
openshift_master_htpasswd_users={'admin': '$apr1$gfaL16Jf$c.5LAvg3xNDVQTkk6HpGB1'}

# Specify exact version of etcd to configure or upgrade to.
etcd_version="3.1.9"
#openshift_repos_enable_testing=true
openshift_disable_check=disk_availability,docker_storage
docker_selinux_enabled=false
openshift_docker_options=" --log-driver=journald --storage-driver=overlay --registry-mirror=http://4a0fee72.m.daocloud.io "
# OpenShift Router Options
# Router selector (optional)
# Router will only be created if nodes matching this label are present.
# Default value: 'region=infra'
openshift_hosted_router_selector='region=infra,router=true'
# default subdomain to use for exposed routes
openshift_master_default_subdomain=app.example.com
# host group for masters
[masters]
master.example.com
# host group for etcd
[etcd]
master.example.com
# Load balancers
[lb]
lb.example.com
# host group for nodes, includes region info
[nodes]
master.example.com openshift_schedulable=true openshift_node_labels="{'region': 'infra', 'router': 'true'}"
node01.example.com openshift_schedulable=true openshift_node_labels="{'region': 'infra', 'router': 'true'}"
node02.example.com openshift_schedulable=true openshift_node_labels="{'region': 'infra', 'router': 'true'}"

運(yùn)行 ansible 手冊(cè)安裝 OpenShift Origin

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

配置 NFS 服務(wù)器

安裝依賴服務(wù)組件并啟動(dòng)服務(wù)

yum install -y nfs-utils rpcbind
rpm -qa | grep -E 'nfs-utils|rpcbind'
systemctl enable rpcbind
systemctl enable nfs
systemctl restart rpcbind
systemctl restart nfs

編輯 /etc/sysconfig/iptables 并新增一下內(nèi)容:

#
# NFS client access allowd settings
#
# The following line must be commented in order to make nfs work properly
#-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -s 192.168.0.0/24 -p tcp --dport 2049 -j ACCEPT

保存配置并重啟 iptables 服務(wù):

service iptables save
service iptables restart

初始化 Persistent Volumes

這里借鑒 minishift 默認(rèn)的 pv 初始化,即預(yù)創(chuàng)建100個(gè) pv (pv0001 ~ pv0100 ) 初始化大小為100Gi
運(yùn)行一下腳本進(jìn)行初始化:

cd $OPENSHIFT_ADMIN/bin
./init-100-pvs.sh

在本機(jī)配置 hosts 映射

Windows 操作系統(tǒng)下編輯 C:\Windows\System32\drivers\etc\hosts
Linux / macOS 操作系統(tǒng)下編輯 /etc/hosts
添加一下內(nèi)容:

192.168.123.155 master.example.com

訪問(wèn) OpenShift Origin 主頁(yè)

訪問(wèn)以下地址確保 OpenShift Origin 可以正確訪問(wèn): https://master.example.com:8443/
用戶賬戶: admin / handhand

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末斑响,一起剝皮案震驚了整個(gè)濱河市菱属,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌舰罚,老刑警劉巖纽门,帶你破解...
    沈念sama閱讀 219,490評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異营罢,居然都是意外死亡赏陵,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,581評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)蝙搔,“玉大人候醒,你說(shuō)我怎么就攤上這事≡尤常” “怎么了倒淫?”我有些...
    開封第一講書人閱讀 165,830評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)败玉。 經(jīng)常有香客問(wèn)我敌土,道長(zhǎng),這世上最難降的妖魔是什么运翼? 我笑而不...
    開封第一講書人閱讀 58,957評(píng)論 1 295
  • 正文 為了忘掉前任返干,我火速辦了婚禮,結(jié)果婚禮上血淌,老公的妹妹穿的比我還像新娘矩欠。我一直安慰自己,他們只是感情好悠夯,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,974評(píng)論 6 393
  • 文/花漫 我一把揭開白布癌淮。 她就那樣靜靜地躺著,像睡著了一般沦补。 火紅的嫁衣襯著肌膚如雪乳蓄。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,754評(píng)論 1 307
  • 那天夕膀,我揣著相機(jī)與錄音虚倒,去河邊找鬼。 笑死产舞,一個(gè)胖子當(dāng)著我的面吹牛魂奥,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播易猫,決...
    沈念sama閱讀 40,464評(píng)論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼耻煤,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了擦囊?” 一聲冷哼從身側(cè)響起违霞,我...
    開封第一講書人閱讀 39,357評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎瞬场,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體涧郊,經(jīng)...
    沈念sama閱讀 45,847評(píng)論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡贯被,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,995評(píng)論 3 338
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片彤灶。...
    茶點(diǎn)故事閱讀 40,137評(píng)論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡看幼,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出幌陕,到底是詐尸還是另有隱情诵姜,我是刑警寧澤,帶...
    沈念sama閱讀 35,819評(píng)論 5 346
  • 正文 年R本政府宣布搏熄,位于F島的核電站棚唆,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏心例。R本人自食惡果不足惜宵凌,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,482評(píng)論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望止后。 院中可真熱鬧瞎惫,春花似錦、人聲如沸译株。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,023評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)歉糜。三九已至欠橘,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間现恼,已是汗流浹背肃续。 一陣腳步聲響...
    開封第一講書人閱讀 33,149評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留叉袍,地道東北人始锚。 一個(gè)月前我還...
    沈念sama閱讀 48,409評(píng)論 3 373
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像喳逛,于是被迫代替她去往敵國(guó)和親瞧捌。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,086評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • 說(shuō)明:本文主要介紹通過(guò)Ansible來(lái)部署Openshift 3.9 一润文、準(zhǔn)備 系統(tǒng)準(zhǔn)備 注:在安裝時(shí)可以通過(guò)an...
    潘曉華Michael閱讀 6,879評(píng)論 4 13
  • 離線安裝 openshift 需要將安裝過(guò)程中用的 rpm 包姐呐、docker image 以及 openshift...
    whyreal閱讀 3,862評(píng)論 0 3
  • Docker — 云時(shí)代的程序分發(fā)方式 要說(shuō)最近一年云計(jì)算業(yè)界有什么大事件?Google Compute Engi...
    ahohoho閱讀 15,535評(píng)論 15 147
  • Kubernetes作為容器應(yīng)用的管理中心典蝌,通過(guò)對(duì)Pod的數(shù)量進(jìn)行監(jiān)控曙砂,并且根據(jù)主機(jī)或容器失效的狀態(tài)將新的Pod調(diào)...
    輝耀輝耀閱讀 4,606評(píng)論 0 13
  • 最近來(lái)自一條杭州的消息通過(guò)各種網(wǎng)絡(luò)途徑火了起來(lái),那就是關(guān)于杭州地鐵的獨(dú)特創(chuàng)意的裝扮骏掀,關(guān)于那些民謠鸠澈,關(guān)于那些網(wǎng)易的大...
    木樨香如故閱讀 684評(píng)論 4 14