mirror of https://github.com/easzlab/kubeasz.git
fix3 多lb节点配置文件格式错误 Issue #286
parent
ced4f34aae
commit
91812bba9f
|
@ -12,7 +12,7 @@
|
||||||
192.168.1.1
|
192.168.1.1
|
||||||
192.168.1.2
|
192.168.1.2
|
||||||
|
|
||||||
# 负载均衡有且仅有两个节点,安装 haproxy+keepalived
|
# 负载均衡(目前已支持多于2节点,一般2节点就够了) 安装 haproxy+keepalived
|
||||||
[lb]
|
[lb]
|
||||||
192.168.1.1 LB_IF="eth0" LB_ROLE=backup # 注意根据实际使用网卡设置 LB_IF变量
|
192.168.1.1 LB_IF="eth0" LB_ROLE=backup # 注意根据实际使用网卡设置 LB_IF变量
|
||||||
192.168.1.2 LB_IF="eth0" LB_ROLE=master
|
192.168.1.2 LB_IF="eth0" LB_ROLE=master
|
||||||
|
|
|
@ -2,9 +2,15 @@ global_defs {
|
||||||
router_id lb-backup
|
router_id lb-backup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vrrp_script check-haproxy {
|
||||||
|
script "killall -0 haproxy"
|
||||||
|
interval 5
|
||||||
|
weight -60
|
||||||
|
}
|
||||||
|
|
||||||
vrrp_instance VI-kube-master {
|
vrrp_instance VI-kube-master {
|
||||||
state BACKUP
|
state BACKUP
|
||||||
priority {{ 110 | random(1, 1) }}
|
priority {{ 119 | random(61, 1) }}
|
||||||
unicast_src_ip {{ inventory_hostname }}
|
unicast_src_ip {{ inventory_hostname }}
|
||||||
unicast_peer {
|
unicast_peer {
|
||||||
{% for h in groups['lb'] %}{% if h != inventory_hostname %}
|
{% for h in groups['lb'] %}{% if h != inventory_hostname %}
|
||||||
|
@ -15,6 +21,9 @@ vrrp_instance VI-kube-master {
|
||||||
interface {{ LB_IF }}
|
interface {{ LB_IF }}
|
||||||
virtual_router_id {{ ROUTER_ID }}
|
virtual_router_id {{ ROUTER_ID }}
|
||||||
advert_int 3
|
advert_int 3
|
||||||
|
track_script {
|
||||||
|
check-haproxy
|
||||||
|
}
|
||||||
virtual_ipaddress {
|
virtual_ipaddress {
|
||||||
{{ MASTER_IP }}
|
{{ MASTER_IP }}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ global_defs {
|
||||||
vrrp_script check-haproxy {
|
vrrp_script check-haproxy {
|
||||||
script "killall -0 haproxy"
|
script "killall -0 haproxy"
|
||||||
interval 5
|
interval 5
|
||||||
weight -30
|
weight -60
|
||||||
}
|
}
|
||||||
|
|
||||||
vrrp_instance VI-kube-master {
|
vrrp_instance VI-kube-master {
|
||||||
|
|
Loading…
Reference in New Issue