I have a setup with 3 nodes each has keepalived and HAProxy installed. Keepalived is installed on the VM but HAProxy is running as part of a docker swarm. HAProxy is running on host network mode.
--VM-1-----------------------------
| HAP-1 |
requests | ___________________ _________|
=========>| |VIP + Keepalived | => |HAProxy||
|| | |_________________| |_______||
|| -----------------------------------
||
|| --------VM-2-----------------------
|| | HAP-2 |
|| | ___________________ _________|
======>| | Keepalived | => |HAProxy||
|| | |_________________| |_______||
|| -----------------------------------
||
|| --VM-3-----------------------------
|| | HAP-3 |
|| | ___________________ _________|
======>| | Keepalived | => |HAProxy||
| |_________________| |_______||
-----------------------------------
At first the VM-1 and HAP-1 are active. When a failure happens on VM-1 the VIP (say for example) move to VM-2. I would like the HAProxy to be on the same machine as the VIP (i.e. HAP-2). When I test the setup it by stopping the keepalived service on VM-1, it just moves the VIP to VM-2 and the HAProxy continues to work on the VM-1. I think docker ingress is handling the connection to HAProxy and routing it to HAP-1 where the keepalived was stopped. Is it possible to switchover the VIP + HAProxy to one of the standby VM ?