Skip to content

Commit

Permalink
更新lb部分设置和文档
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgao1983 committed Mar 2, 2018
1 parent 9d83fe5 commit ddb762f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions docs/00-集群规划和基础参数设定.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
+ lb节点 x2 : 负载均衡节点两个,安装 haproxy+keepalived
+ node节点 x3 : 真正应用负载的节点,根据需要增加机器配置和节点数

请注意对于多节点集群,请确保各节点时区设置一致,并使用ntp服务器同步各节点时间。

生产环境使用建议一个节点只是一个角色,避免性能瓶颈问题,这里演示环境将节点绑定多个角色。项目预定义了3个例子,请修改后完成适合你的集群规划。

+ [单节点](../example/hosts.allinone.example)
Expand Down
4 changes: 2 additions & 2 deletions docs/01-创建CA证书和环境配置.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ listen kube-master
mode tcp
option tcplog
balance source
server s1 {{ LB_EP1 }} check inter 10000 fall 2 rise 2 weight 1
server s2 {{ LB_EP2 }} check inter 10000 fall 2 rise 2 weight 1
server s1 {{ master1 }} check inter 10000 fall 2 rise 2 weight 1
server s2 {{ master2 }} check inter 10000 fall 2 rise 2 weight 1
```
如果用apt安装的话,可以在/usr/share/doc/haproxy目录下找到配置指南configuration.txt.gz,全局和默认配置这里不展开,关注`listen` 代理设置模块,各项配置说明:
+ 名称 kube-master
Expand Down
12 changes: 6 additions & 6 deletions example/hosts.m-masters.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
192.168.1.2 NODE_IP="192.168.1.2"

# 负载均衡至少两个节点,安装 haproxy+keepalived
# 根据master节点数量同步修改roles/lb/templates/haproxy.cfg.j2
[lb]
192.168.1.1 LB_IF="eth0" LB_ROLE=backup
192.168.1.1 LB_IF="eth0" LB_ROLE=backup # 注意根据实际使用网卡设置 LB_IF变量
192.168.1.2 LB_IF="eth0" LB_ROLE=master
[lb:vars]
LB_EP1="192.168.1.1:6443" # api-server 实际成员地址端口
LB_EP2="192.168.1.2:6443" # api-server 实际成员地址端口
MASTER_PORT="8443" # api-server 服务端口
master1="192.168.1.1:6443" # 根据实际master节点数量设置
master2="192.168.1.2:6443" # 需同步设置roles/lb/templates/haproxy.cfg.j2
#master3="192.168.1.x:6443"
MASTER_PORT="8443" # 设置 api-server VIP地址的服务端口

[kube-node]
192.168.1.2 NODE_ID=node1 NODE_IP="192.168.1.2"
Expand All @@ -38,7 +38,7 @@ MASTER_PORT="8443" # api-server 服务端口

[all:vars]
# ---------集群主要参数---------------
#集群 MASTER IP, 需要负载均衡,一般为VIP地址
#集群 MASTER IP,一般为VIP地址
MASTER_IP="192.168.1.10"
KUBE_APISERVER="https://192.168.1.10:8443"

Expand Down
4 changes: 2 additions & 2 deletions roles/lb/templates/haproxy.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ listen kube-master
mode tcp
option tcplog
balance source
server s1 {{ LB_EP1 }} check inter 10000 fall 2 rise 2 weight 1
server s2 {{ LB_EP2 }} check inter 10000 fall 2 rise 2 weight 1
server s1 {{ master1 }} check inter 10000 fall 2 rise 2 weight 1
server s2 {{ master2 }} check inter 10000 fall 2 rise 2 weight 1

0 comments on commit ddb762f

Please sign in to comment.