Skip to content

Commit

Permalink
取消lb组变量设置
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgao1983 committed Jun 9, 2018
1 parent 931b2cf commit 82badc4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 0 additions & 5 deletions example/hosts.m-masters.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
[lb]
192.168.1.1 LB_IF="eth0" LB_ROLE=backup # 注意根据实际使用网卡设置 LB_IF变量
192.168.1.2 LB_IF="eth0" LB_ROLE=master
[lb:vars]
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"
ROUTER_ID=57 # 取值在0-255之间,区分多个instance的VRRP组播,同网段不能重复

[kube-node]
192.168.1.2
Expand Down
4 changes: 4 additions & 0 deletions roles/lb/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 区分多个instance的VRRP组播,同网段不能重复,取值在0-255之间
# 可以直接指定数字,如ROUTER_ID=59
# 本项目取100~200间的随机数
ROUTER_ID: {{ 200 | random(100,1) }}
8 changes: 6 additions & 2 deletions roles/lb/templates/haproxy.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ listen kube-master
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
{% 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 %}

0 comments on commit 82badc4

Please sign in to comment.