forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 集群节点的公共配置任务 | ||
- hosts: | ||
- kube-master | ||
roles: | ||
- prepare | ||
|
||
# [可选]多master部署时的负载均衡配置 | ||
- hosts: lb | ||
roles: | ||
- lb | ||
|
||
- hosts: kube-master | ||
roles: | ||
- kube-master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## 增加 kube-master 节点 | ||
|
||
注意:目前仅支持按照本项目`多主模式`(hosts.m-masters.example)部署的`k8s`集群增加`master`节点 | ||
|
||
新增`kube-master`节点大致流程为: | ||
- 节点预处理 prepare | ||
- 重新配置LB节点的 haproxy服务 | ||
- 安装 master 节点服务 | ||
|
||
### 操作步骤 | ||
|
||
按照本项目说明,首先确保deploy节点能够ssh免密码登陆新增节点,然后在**deploy**节点执行三步: | ||
|
||
- 修改ansible hosts 文件,在 [kube-master] 组添加新增的节点;在[lb] 组添加新增master 节点,举例如下: | ||
|
||
``` bash | ||
[kube-master] | ||
192.168.1.1 NODE_IP="192.168.1.1" | ||
192.168.1.2 NODE_IP="192.168.1.2" | ||
192.168.1.5 NODE_IP="192.168.1.5" # 新增 master节点 | ||
|
||
[lb] | ||
192.168.1.1 LB_IF="ens3" LB_ROLE=backup | ||
192.168.1.4 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节点 | ||
``` | ||
- 修改roles/lb/templates/haproxy.cfg.j2 文件,增加新增的master节点,举例如下: | ||
|
||
``` bash | ||
listen kube-master | ||
bind 0.0.0.0:{{ MASTER_PORT }} | ||
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 | ||
``` | ||
|
||
- 执行安装脚本 | ||
|
||
``` bash | ||
$ cd /etc/ansible && ansible-playbook 20.addmaster.yml | ||
``` | ||
|
||
### 验证 | ||
|
||
``` bash | ||
# 在新节点master 服务状态 | ||
$ systemctl status kube-apiserver | ||
$ systemctl status kube-controller-manager | ||
$ systemctl status kube-scheduler | ||
|
||
# 查看新master的服务日志 | ||
$ journalctl -u kube-apiserver -f | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters