I use Haproxy as a load balancer to stream SSH connections to the backend servers. To avoid Haproxy being a single point of failure, I have two Haproxies which are monitored via Keepalived and work together as a proxy cluster as shown below.
If the primary Haproxy is down, the virtual IP will automatically bind to the second proxy and new connections will be served via the secondary proxy. However, my previously active connections which were flowing via the primary Haproxy are lost now.
In the case of a planned outage for the primary HAproxy host, is there a way, I can drain the connections in the primary Haproxy and simultaneously start accepting the new connections in the secondary Haproxy? Any other tools or proxies with the above capabilities should also work for me.
Currently, my Haproxy hosts are VMs. Wondering, if I move this to a Kubernetes cluster, I can drain one pod while the other pods serve connections.