jcmoraisjr / haproxy-ingress

HAProxy Ingress
https://haproxy-ingress.github.io
Apache License 2.0
1.04k stars 269 forks source link

Q: Support for keepalived to enable HA #8

Closed thekalinga closed 7 years ago

thekalinga commented 7 years ago

I see that there is a project that enables keep alived within kubernetes. https://github.com/kubernetes/contrib/tree/master/keepalived-vip

Just wanted to check if the following topology for high available load balancer configuration is supported with floating ips

ha proxy high avaiability

jcmoraisjr commented 7 years ago

If I understood you correctly, the requests to the floating IP will reach one of the loadbalancers, that will be redirected to one of the pods. So no problem, this should work as expected.

But take in mind that:

rikatz commented 7 years ago

@jcmoraisjr You could use the same stickness session implemented in NGINX, with the first set cookie containing the route that the Frontend took to the pod.

https://github.com/kubernetes/ingress/blob/master/examples/affinity/cookie/nginx/README.md

Anyway don't know if HAProxy supports this kind of affinity :)

jcmoraisjr commented 7 years ago

Closing this issue. You can add a new comment if you have any doubt.

antonmatsiuk commented 5 years ago

unfortunately, kube-keepalived works only with kubernetes services, while HAProxy DaemonSet uses "hostNetwork". I solved the issue by installing keepalived directly on the Nodes (HAProxy Pods needs to be scheduled exactly on these Nodes which can be controller via nodeSelector labels). An example of keepalived configuration which works in this case:

vrrp_script check_haproxy {
    script "pidof haproxy"
    interval 5
    fall 2
    rise 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth1
    virtual_router_id 51
    priority 101
    advert_int 1
    track_script {
      check_haproxy
    }
    virtual_ipaddress {
        192.168.2.5
    }
}
guptaarvindk commented 5 years ago

@antonmatsiuk best solution is to run keepliaved as side care container to HAPROXY.