Hi all,
I’ve been playing around with running keepalived inside Rancher. The very basic Keepalived functionality is already working, and i can restart containers, and the IP will become active on other Rancher hosts. So far so good.
If I schedule a load balancer on each host, that has the rancher loadbalancer running, I can connect to my stack’s services perfectly!
Now, I’m trying to integrate the keepalived with Rancher’s metadata service, because I don’t want the IP to be active on a host, on which the loadbalancer either isn’t active, or where the health of the load balancer is bad.
To do this, I’ve thought about multiple solutions, I can use the healthcheck scripts from keepalived to poll the rancher-metadata service, but this will generate periodic load, and will not work very flexible, and the most important thing is, it will have delays.
I’ve found this gist: https://gist.github.com/vincent99/491afed2306ba448dd89 to use websockets and listen to events.
The idea is to use the rancher-metdata service to determine the priority of keepalived (because the more keepalived containers you have, the lower the priority of the keepalived should be, because you don’t want the IP to move hosts for every new container you start).
The other idea is to use websocket events to trigger keepalived to fail hard if it cannot garuantee that the host where it’s running will accept the traffic for the VIP.
The thing is: I don’t know wether this is a good design. Can any of you guys tell me whether the path if chosen is the right one? I’m bit new to rancher’s internals, but for what i’ve seen, i can get enough information from the rancher-metadata service to get info regarding the load balancer, but i’ve not yet finished the websocket connection.
Any thoughts?