2023-04-26 20:09:46 +08:00
|
|
|
|
global_defs {
|
|
|
|
|
script_user root # 脚本执行者
|
|
|
|
|
enable_script_security # 标记脚本安全
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vrrp_script check {
|
2023-09-13 10:45:29 +08:00
|
|
|
|
script "killall -0 kube-apiserver" # 脚本路径
|
2023-04-26 20:09:46 +08:00
|
|
|
|
interval 2 # 脚本执行间隔,单位s
|
|
|
|
|
weight -20 # -254-254之间,检测失败权重减少
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vrrp_instance VI_1 { # 实例名
|
2023-09-13 10:45:29 +08:00
|
|
|
|
state BACKUP # 3个实例,1个配置MASTER,另外2个配置BACKUP, 非抢占式配置BACKUP
|
|
|
|
|
interface __NETWORK_NIC__
|
2023-04-26 20:09:46 +08:00
|
|
|
|
virtual_router_id 251 # ID主备需一致
|
|
|
|
|
priority 100 # 默认权重,3个节点保持不一致,并且MASTER最大,priority之间的差值要小于weight
|
2023-09-13 10:45:29 +08:00
|
|
|
|
nopreempt # 非抢占式
|
2023-04-26 20:09:46 +08:00
|
|
|
|
|
|
|
|
|
authentication {
|
|
|
|
|
auth_type PASS # 主备验证信息,需一致
|
|
|
|
|
auth_pass 123456
|
|
|
|
|
}
|
|
|
|
|
track_script {
|
|
|
|
|
check
|
|
|
|
|
}
|
2023-09-12 17:20:40 +08:00
|
|
|
|
unicast_src_ip __MASTER1__
|
2023-04-26 20:09:46 +08:00
|
|
|
|
unicast_peer {
|
2023-09-12 17:20:40 +08:00
|
|
|
|
__MASTER2__
|
|
|
|
|
__MASTER3__
|
2023-04-26 20:09:46 +08:00
|
|
|
|
}
|
|
|
|
|
virtual_ipaddress {
|
2023-09-13 10:45:29 +08:00
|
|
|
|
__VIP__ dev __NETWORK_NIC__
|
2023-04-26 20:09:46 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|