-
Notifications
You must be signed in to change notification settings - Fork 964
Description
First of all, a big round of applause to having a vip / high-availability doc finally! 🎉 🎉 🎉 (#16645)
https://documentation.ubuntu.com/lxd/latest/howto/cluster_vip/
May I request some updates to cover more topics on top, to be more production ready?
No health check
Lines 38 to 47 in 08814e3
vrrp_instance VI_1 { | |
state MASTER | |
interface enp5s0 | |
virtual_router_id 41 | |
priority 200 | |
advert_int 1 | |
virtual_ipaddress { | |
192.0.2.50/24 | |
} | |
} |
The current configuration doesn't monitor LXD port so VIP can sit on a node where LXD service may have already crashed in the worst case scenario. It would be good to check the status of the backend service and a vip follows the status of it. i.e. the vip should always run on a node where LXD service is available.
One example is to check the TCP port, and you can see some examples such as in the charmed-keepalived config.
"chk_svc_port" part in:
https://github.com/charmed-kubernetes/charm-keepalived/blob/main/src/templates/keepalived.conf
HAProxy example
Further more, it would be great if it checks the actual API HTTP(S) response from the LXD endpoint instead of relying on the TCP connection only. To do so, it's a good idea to employ HAProxy as mentioned in the following section, which is good.
Line 158 in 08814e3
Alternatively, consider combining Keepalived with an implementation of [HAProxy](https://www.haproxy.org/). HAProxy is a reverse proxy that can redirect traffic for both TCP and HTTP protocols, which means that it can handle load balancing both API and UI traffic for LXD clusters. |
What we are missing here and would like to have is an actual example to setup HAProxy for production usage. One example is to have a sample haproxy.cfg to load-balance the traffic to multiple backend servers with a health check not to redirect traffic to non-functional backend. Also, it would be essential to configure a vip for HAProxy with pacemaker/corosync so that the vip can follow the status of HAProxy so the traffic still works even if one of the 3 HAProxy instances fails.
Document: howto/cluster_vip.md