51 lines
1.0 KiB
Plaintext
51 lines
1.0 KiB
Plaintext
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
|
|
script "/usr/lib/keepalived/scripts/chk_kube_apiserver.sh 192.168.2.2 6443"
|
|
interval 2
|
|
weight 2
|
|
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
|
|
nopreempt
|
|
|
|
authentication {
|
|
auth_type PASS
|
|
auth_pass $PASSWORD
|
|
}
|
|
|
|
unicast_src_ip $SRC_IP
|
|
|
|
unicast_peer {
|
|
$PEER_IP_0
|
|
$PEER_IP_1
|
|
}
|
|
|
|
virtual_ipaddress {
|
|
192.168.2.2/32
|
|
}
|
|
|
|
track_script {
|
|
haproxy-check
|
|
}
|
|
} |