简化新增节点步骤

pull/243/merge
gjmzj 2018-06-10 08:32:34 +08:00
parent 9f172965ac
commit af872c8e7b
4 changed files with 15 additions and 33 deletions

View File

@ -13,40 +13,21 @@
### 操作步骤
按照本项目说明首先确保deploy节点能够ssh免密码登陆新增节点然后在**deploy**节点执行步:
按照本项目说明首先确保deploy节点能够ssh免密码登陆新增节点然后在**deploy**节点执行步:
- 修改ansible hosts 文件,在 [new-master] 组添加新增的节点;在[lb] 组添加新增master 节点,举例如下:
- 修改ansible hosts 文件,在 [new-master] 组添加新增的节点,举例如下:
``` bash
[lb]
192.168.1.1 LB_IF="ens3" LB_ROLE=backup
192.168.1.2 LB_IF="ens3" LB_ROLE=master
[lb:vars]
master1="192.168.1.1:6443"
master2="192.168.1.2:6443"
master3="192.168.1.5:6443" # 新增 master节点
...
[new-master]
192.168.1.5 # 新增 master节点
```
- 修改roles/lb/templates/haproxy.cfg.j2 文件增加新增的master节点举例如下
``` bash
listen kube-master
bind 0.0.0.0:{{ KUBE_APISERVER.split(':')[2] }}
mode tcp
option tcplog
balance source
server s1 {{ master1 }} check inter 10000 fall 2 rise 2 weight 1
server s2 {{ master2 }} check inter 10000 fall 2 rise 2 weight 1
server s3 {{ master3 }} check inter 10000 fall 2 rise 2 weight 1 # 新增 master节点
```
- 执行安装脚本
``` bash
$ cd /etc/ansible && ansible-playbook 21.addmaster.yml
$ ansible-playbook /etc/ansible/21.addmaster.yml
```
### 验证

View File

@ -16,13 +16,13 @@
...
# 预留组后续添加node节点使用
[new-node]
192.168.1.6 NODE_ID=node6
192.168.1.6 #新增node节点
...
```
- 执行安装脚本
``` bash
$ cd /etc/ansible && ansible-playbook 20.addnode.yml
$ ansible-playbook /etc/ansible/20.addnode.yml
```
### 验证

View File

@ -1,4 +1,5 @@
# 区分多个instance的VRRP组播同网段不能重复取值在0-255之间
# 可以直接指定数字如ROUTER_ID=59
# 本项目取100~200间的随机数
ROUTER_ID: "{{ 200 | random(100,1) }}"
# 可以直接指定数字如ROUTER_ID: 69
# 取100~200间的随机数
#ROUTER_ID: "{{ 200 | random(100,1) }}"
ROUTER_ID: 69

View File

@ -20,9 +20,9 @@ listen kube-master
mode tcp
option tcplog
balance source
{% for host in groups['kube-master'] %}
server {{host.inventory_hostname}} {{host.inventory_hostname}}:6443 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% for host in groups['new-master'] %}
server {{host.inventory_hostname}} {{host.inventory_hostname}}:6443 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% for host in groups['kube-master'] %}
server {{ host }} {{ host }}:6443 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}
{% for host in groups['new-master'] %}
server {{ host }} {{ host }}:6443 check inter 2000 fall 2 rise 2 weight 1
{% endfor %}