KeepailveD HAProxy cluster - MirgDenis/scripts GitHub Wiki

KeepaliveD config

vrrp_instance VIP {
        interface ens3
        nopreempt              # Do not elect new master when node with higher prior returned
        dont_track_primary     # Ignore VRRP interface faults
        state BACKUP           # Doesn't matter a lot
        virtual_router_id 51   # Same on every node
        priority 101           # Different on every node
        virtual_ipaddress {
            10.188.239.14      # Virtual IP
        }
}

HAProxy config

Add following line to /etc/sysctl.conf net.ipv4.ip_nonlocal_bind=1 and run sysctl -p
HAPproxy listen section for k8s:

listen k8s-api
        bind 10.188.239.14:8080
        mode tcp
        option tcplog
        option tcp-check
        server k8s-master-0 10.188.239.20:6443 check
        server k8s-master-1 10.188.239.7:6443 check
        server k8s-master-2 10.188.239.9:6443 check