Hello
I want to run HAProxy 1.6.8 with a backend server that may have multiple
A records corresponding to different containers.
During testing I noticed that HAProxy only tries to connect to the first
A record returned, instead of cycling through the different IP addresses
returned (effectively treating every IP as a different backend server,
with independent health checks). In case of a timeout the whole backend
is treated as DOWN as well, instead of trying the next IP address.
The reason for this setup is that it would be easier for me to add and
remove backend containers in DNS than generating a new HAProxy
configuration and reloading HAProxy whenever something changes.
This is an example configuration I used during testing:
global
stats timeout 30s
resolvers containers
nameserver knot ns-containers.example.com:53
frontend nginx
bind :80
default_backend nginx
backend nginx
timeout connect 1s
timeout server 1s
server nginx nginx.containers.example.com:80 check resolvers containers
resolve-prefer ipv4
With the following DNS response by the configured nameserver HAProxy
only connects to 172.17.0.5:
$ dig +short @ns-containers.example.com nginx.containers.example.com
172.17.0.5
172.17.0.6
Is there a configuration setting / workaround for this? If not: Is this
something that could be introduced in a future version or does it
conflict with a design decision?
Best regards
Tim Düsterhus