HAProxy to use DNS from operating system? HAProxy to use DNS from operating system? kubernetes kubernetes

HAProxy to use DNS from operating system?


Seems to be correct that HAProxy does cache the resolved IP unless you tell it otherwise.

As you already found the configuration using a resolver and a custom check interval should do the trick (resolvers dns check inter 1000 and hold valid), but you are also right that this requires a resolvers section as well. Since HAProxy 1.9 you can use parse-resolv-conf to use the local resolver:

resolvers mydns  parse-resolv-conf  hold valid 10sbackend site-backend  balance leastconn  server site server.example.com:80 resolvers mydns check inter 1000

The HAProxy documentation can help you with further configuration: https://cbonte.github.io/haproxy-dconv/1.9/configuration.html#5.3.2-parse-resolv-conf