How to configure keepalived for one HAProxy container without the Ingress routing mesh on Docker Swarm

1k Views Asked by At

I try to follow this blog post to setup "One HAProxy Container Without the Ingress Routing Mesh" on the Docker Swarm. Except that instead of 3 VMs I have 3 VPS nodes and each has its own static public ip address.

I'm not familiar with keepalived and I don't understand how to configure it to make it work in between my vps nodes.

Below is an example of the keepalived config from this blog:

vrrp_script haproxy_container {
    script "/usr/bin/docker container ls --filter name=haproxy_service | /bin/grep haproxy_service"
    interval 5
    weight -20
    fall 2
    rise 2
}

vrrp_instance VI_1 {
    interface ens192
    state BACKUP
    virtual_router_id 205
    priority 100
    virtual_ipaddress {
        10.64.137.205/32
    }
    track_script {
        haproxy_container
    }
}

How to make keepalived redirect traffic to the correct node ? What does this configuration (vrrp_instance) even mean ?

0

There are 0 best solutions below