I have implemented something similar to allow use to dynamically load-balance between multiple backends that are all joined to each other as part of a Hazelcast cluster. All of which is running in an AWS VPC, with autoscaling groups to control spin up and down of new members of the cluster based on load, etc.
What we ended up doing is righting custom code that attached to the hazelcast cluster as a client, and periodically queried the cluster for the current list of servers, and their IP addresses. The coded would then rewrite the HAProxy configuration, filling in the correct backend list. Then via a shell call (sadly, Java can't do Unix domain sockets to write directly to the server), it would tell HAProxy to restart gracefully. In our use case, this works great, as we don't have long-running TCP connections (these servers typically serve REST API calls or static HTML content with no keep-alive.) I'm also open to suggestions on how this could be improved too, especially with 1.6 possibly. Ed ------------------------------ ✉ Eduard Martinescu <emartine...@salsalabs.com> | ✆ (585) 708-9685 | [image: http://www.salsalabs.com] <http://www.salsalabs.com/> - ignite action. fuel change. On Fri, Sep 18, 2015 at 9:21 AM, Baptiste <bed...@gmail.com> wrote: > On Fri, Sep 18, 2015 at 3:18 PM, Smain Kahlouch <smain...@gmail.com> > wrote: > >> If I may chime in here: Kubernetes supports service discovery through > DNS > >> SRV records for most use-cases, so the dynamic DNS support that Baptiste > >> is > >> currently working on would be a perfect fit. No special API support > >> required. > > > > > > Well dns would be great but, as far as i know, kubernetes uses dns only > for > > services name, not for pods. > > A pod can be seen as a server in a backend, the number of servers and > their > > ip addresses can change frequently. > > I'll dig further... > > > > Thanks, > > Smana > > > That's usually the purpose of DNS SRV records ;) > > Baptiste > >