ansible安裝多節(jié)點(diǎn) openshift 3.7集群

參考鏈接:https://docs.openshift.org/latest/install_config/install/advanced_install.html

主機(jī)準(zhǔn)備

類型 主機(jī)名 IP 操作系統(tǒng) CPU 內(nèi)存
Master master.rabbit.com 192.168.8.207 CentOS 7.3 2核4G
Node1 node1.rabbit.com 192.168.8.208 CentOS 7.3 2核2G

安裝前預(yù)配置 所有節(jié)點(diǎn)都要執(zhí)行

1. 配置每個(gè)節(jié)點(diǎn)主機(jī)名
hostnamectl set-hostname master.rabbit.com  #master節(jié)點(diǎn)執(zhí)行
hostnamectl set-hostname node1.rabbit.com   #node1節(jié)點(diǎn)執(zhí)行
2. 編輯每個(gè)節(jié)點(diǎn) /etc/hosts
192.168.8.207 master.rabbit.com
192.168.8.208 node1.rabbit.com

ping 每個(gè)節(jié)點(diǎn)看是否可到達(dá)

3. 每個(gè)節(jié)點(diǎn)開啟SELinux
configure SELINUXTYPE=targeted in the /etc/selinux/config file:

# 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 these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
4. 關(guān)閉所有節(jié)點(diǎn)的防火墻
systemctl stop firewalld
systemctl disable firewalld

安裝及配置軟件包

1. 所有的節(jié)點(diǎn)下執(zhí)行以下命令安裝Openshift依賴的軟件包肺缕。
yum install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct
yum update
2. 安裝docker 配置阿里云加速器
yum install -y docker
systemctl enable docker

參考鏈接:http://blog.xianshiyue.com/%E5%AE%89%E8%A3%85docker/

3. Configuring Docker Storage

參考鏈接:http://blog.xianshiyue.com/docker-storage-setup-%E9%85%8D%E7%BD%AEdocker-%E5%90%8E%E7%AB%AF%E5%AD%98%E5%82%A8/

4. 配置 Docker Container Logs

參考鏈接:http://blog.xianshiyue.com/docker-log-%E9%85%8D%E7%BD%AE/

5. 啟動(dòng) docker
    systemctl start docker

后面的步驟都在master節(jié)點(diǎn)上執(zhí)行

6. 需要啟用EPEL倉庫以安裝Ansible
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/epel.repo
yum -y --enablerepo=epel install ansible pyOpenSSL
7. 下載 openshift-ansible ,我這里下載3.7 版本

地址:https://github.com/openshift/openshift-ansible

8. 確保所有的節(jié)點(diǎn)之間可以正常的訪問,需要生成SSH密鑰
ssh-keygen
for host in master.rabbit.com node1.rabbit.com ;do ssh-copy-id -i ~/.ssh/id_rsa.pub $host;done

配置Ansible

配置Ansible的hosts配置文件(記錄了Ansible需要操作的目標(biāo)主機(jī)信息)泣矛。

1. 備份原有的hosts文件
mv -f /etc/ansible/hosts /etc/ansible/hosts.org
2. 創(chuàng)建/etc/ansible/hosts文件逾礁,添加下面的內(nèi)容歌焦。
# Create an OSEv3 group that contains the masters, nodes, and etcd groups
[OSEv3:children]
masters
nodes
etcd

# 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_release=3.7.0
openshift_deployment_type=origin
openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability,package_version,package_availability
# 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'}]

# host group for masters
[masters]
master.rabbit.com

# host group for etcd
[etcd]
master.rabbit.com

# host group for nodes, includes region info
[nodes]
master.rabbit.com openshift_schedulable=True openshift_node_labels="{'region': 'infra'}"
node1.rabbit.com openshift_node_labels="{'region': 'infra', 'zone': 'east'}"

執(zhí)行安裝

ansible-playbook ~/openshift-ansible-openshift-ansible-3.7.22-1/playbooks/byo/config.yml

安裝過程比較長坑匠,耐心等待验懊,一般情況都不會(huì)太順利吭服,會(huì)有錯(cuò)誤嚷堡,根據(jù)提示解決錯(cuò)誤后繼續(xù)執(zhí)行相同的命令安裝


遇到的問題:

1. Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#56 - "Recv failure: Connection reset by peer"

處理參考鏈接
http://blog.csdn.net/dmt742055597/article/details/78580008?locationNum=10&fps=1
http://blog.xianshiyue.com/centos-%E6%B7%BB%E5%8A%A0yum%E6%BA%90/
http://www.itdadao.com/articles/c15a681465p0.html

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市艇棕,隨后出現(xiàn)的幾起案子蝌戒,更是在濱河造成了極大的恐慌串塑,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,183評(píng)論 6 516
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件北苟,死亡現(xiàn)場離奇詭異桩匪,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)友鼻,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,850評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門吸祟,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人桃移,你說我怎么就攤上這事屋匕。” “怎么了借杰?”我有些...
    開封第一講書人閱讀 168,766評(píng)論 0 361
  • 文/不壞的土叔 我叫張陵过吻,是天一觀的道長。 經(jīng)常有香客問我蔗衡,道長纤虽,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,854評(píng)論 1 299
  • 正文 為了忘掉前任绞惦,我火速辦了婚禮逼纸,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘济蝉。我一直安慰自己杰刽,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,871評(píng)論 6 398
  • 文/花漫 我一把揭開白布王滤。 她就那樣靜靜地躺著贺嫂,像睡著了一般。 火紅的嫁衣襯著肌膚如雪雁乡。 梳的紋絲不亂的頭發(fā)上第喳,一...
    開封第一講書人閱讀 52,457評(píng)論 1 311
  • 那天,我揣著相機(jī)與錄音踱稍,去河邊找鬼曲饱。 笑死,一個(gè)胖子當(dāng)著我的面吹牛珠月,可吹牛的內(nèi)容都是我干的扩淀。 我是一名探鬼主播,決...
    沈念sama閱讀 40,999評(píng)論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼桥温,長吁一口氣:“原來是場噩夢(mèng)啊……” “哼引矩!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,914評(píng)論 0 277
  • 序言:老撾萬榮一對(duì)情侶失蹤旺韭,失蹤者是張志新(化名)和其女友劉穎氛谜,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體区端,經(jīng)...
    沈念sama閱讀 46,465評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡值漫,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,543評(píng)論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了织盼。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片杨何。...
    茶點(diǎn)故事閱讀 40,675評(píng)論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖沥邻,靈堂內(nèi)的尸體忽然破棺而出危虱,到底是詐尸還是另有隱情,我是刑警寧澤唐全,帶...
    沈念sama閱讀 36,354評(píng)論 5 351
  • 正文 年R本政府宣布埃跷,位于F島的核電站,受9級(jí)特大地震影響邮利,放射性物質(zhì)發(fā)生泄漏弥雹。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,029評(píng)論 3 335
  • 文/蒙蒙 一延届、第九天 我趴在偏房一處隱蔽的房頂上張望剪勿。 院中可真熱鬧,春花似錦方庭、人聲如沸厕吉。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,514評(píng)論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽赴涵。三九已至,卻和暖如春订讼,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背扇苞。 一陣腳步聲響...
    開封第一講書人閱讀 33,616評(píng)論 1 274
  • 我被黑心中介騙來泰國打工欺殿, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人鳖敷。 一個(gè)月前我還...
    沈念sama閱讀 49,091評(píng)論 3 378
  • 正文 我出身青樓脖苏,卻偏偏與公主長得像,于是被迫代替她去往敵國和親定踱。 傳聞我的和親對(duì)象是個(gè)殘疾皇子棍潘,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,685評(píng)論 2 360

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