I’m trying to implement load balacing on a swarm service the same way it is implemented in the following article : HAProxy on Docker Swarm: Load Balancing and DNS Service Discovery - HAProxy Technologies but with the special dns
tasks.<service-name> instead of the dnsrr endpoint mode.
I thought the
tasks.<service-name> was behaving the same way as the dnsrr mode.
But I can’t manage to get the dns resolution to work, my config is the same as in the blog :
resolvers docker nameserver dns 127.0.0.11:53 resolve_retries 3 timeout resolve 1s timeout retry 1s hold other 10s hold refused 10s hold nx 10s hold timeout 10s hold valid 10s hold obsolete 10s
backend <service> balance roundrobin option httpchk GET /chk "HTTP/1.1\r\nHost:\ <service>" http-check expect string "OK" default-server inter 30000 rise 1 fall 3 maxconn 16 maxqueue 16 server-template <service>- 16 tasks.<service>:3000 check resolvers docker init-addr libc,none
If I use “stack deploy” or “service restart”, the haproxy will start with resolving correctly and all my backends will be green (
service/service-10 changed its IP from (none) to 10.0.8.28 by DNS cache), but then, on the next check I get resolution problems (
unspecified DNS error).
Is it possible to use server-template this way, or must I use the dnsrr endpoint mode ?
I’m using haproxy 2.4.9.