2023-07-03 19:47:20 +00:00
|
|
|
global_defs {
|
|
|
|
vrrp_version 2
|
|
|
|
vrrp_garp_master_delay 1
|
|
|
|
vrrp_garp_master_refresh 60
|
|
|
|
enable_script_security
|
|
|
|
}
|
|
|
|
|
|
|
|
vrrp_script haproxy-check {
|
|
|
|
# -0 checks if the process is running
|
2023-07-13 20:11:11 +00:00
|
|
|
script "/usr/lib/keepalived/scripts/chk_kube_apiserver.sh 192.168.2.2 6443"
|
2023-07-03 19:47:20 +00:00
|
|
|
interval 2
|
2023-07-14 19:03:31 +00:00
|
|
|
weight 2
|
2023-07-03 19:47:20 +00:00
|
|
|
user keepalived_script
|
|
|
|
}
|
|
|
|
|
|
|
|
vrrp_instance haproxy-virtual-ip {
|
|
|
|
state $STATE
|
|
|
|
|
|
|
|
# Make sure the interface is aligned with your server's network interface
|
|
|
|
interface $INTERFACE
|
|
|
|
|
|
|
|
# The virtual router ID must be unique to each VRRP instance that you define
|
|
|
|
virtual_router_id 55
|
|
|
|
|
|
|
|
# Make sure the priority is higher on the master server than on backup servers
|
|
|
|
priority $PRIORITY
|
|
|
|
|
|
|
|
# advertisement interval, 1 second
|
|
|
|
advert_int 1
|
|
|
|
|
|
|
|
authentication {
|
|
|
|
auth_type PASS
|
|
|
|
auth_pass $PASSWORD
|
|
|
|
}
|
|
|
|
|
|
|
|
unicast_src_ip $SRC_IP
|
|
|
|
|
|
|
|
unicast_peer {
|
|
|
|
$PEER_IP_0
|
|
|
|
$PEER_IP_1
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual_ipaddress {
|
2023-07-13 20:11:11 +00:00
|
|
|
192.168.2.2/32
|
2023-07-03 19:47:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
track_script {
|
|
|
|
haproxy-check weight 20
|
|
|
|
}
|
|
|
|
}
|