openshift v3.6 多节点安装

设置ssh 无密码登陆

默认在 ~/.ssh目录生成两个文件:
id_rsa :私钥
id_rsa.pub :公钥

1
ssh-keygen -t rsa

导入本机

1
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

导入要免密码登录的服务器,首先将公钥复制到服务器

1
scp ~/.ssh/id_rsa.pub xxx@host:/home/xxx/id_rsa.pub

在服务器上更改pub文件权限

1
2
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

环境准备

通过yum 安装 ansible

1
yum install ansible

修改/etc/ansible/hosts

1
2
3
4
5
6
7
openshift-lb
openshift-master-1
openshift-master-2
openshift-master-3
openshift-node-1
openshift-node-2
openshift-node-3

测试ansible 是否可用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@openshift-lb ansible]# ansible all -m ping
openshift-node-2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
openshift-master-1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
openshift-master-2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
openshift-master-3 | SUCCESS => {
"changed": false,
"ping": "pong"
}
openshift-node-1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
openshift-node-3 | SUCCESS => {
"changed": false,
"ping": "pong"
}

使用ansible 修改hosts文件

1
ansible all -m copy -a "src=/etc/hosts dest=/etc/hosts"

bug

1
2
3
4
5
6
7
8
9
error: %preun(tuned-profiles-origin-node-3.6.0-1.0.c4dd4cf.x86_64) scriptlet failed, exit status 1
Error in PREUN scriptlet in rpm package tuned-profiles-origin-node-3.6.0-1.0.c4dd4cf.x86_64
Verifying : tuned-profiles-origin-node-3.6.0-1.0.c4dd4cf.x86_64 1/1
Failed:
tuned-profiles-origin-node.x86_64 0:3.6.0-1.0.c4dd4cf
解决方案
rpm -e --noscripts --allmatches tuned-profiles-origin-node.x86_64

安装openshift

下载openshift-ansible

1
git clone https://github.com/openshift/openshift-ansible.git

修改/etc/ansible/host文件

1
2

坚持原创技术分享,您的支持将鼓励我继续创作!