DNS wont continue to resolve?

HAProxy - HA-Proxy version 2.0.14-1ppa1~bionic 2020/04/16

Setting up HAProxy for the first time. It has gone swimmingly and works well. However I would like to resolve the backends by DNS for simplicity in our environment. I have tried to set up the resolvers section and heres the weird thing. It works GREAT! For about 10 seconds. When I restart haproxy everything come up and it all works excellent. It routes to where I need to go and everything. Then after about that first 10 seconds or so it shows as Maintenance on the stats page and the error says:

haproxy[3273]: [WARNING] 106/161936 (3274) : Server bobserver/bobs-server is going DOWN for maintenance (unspecified DNS error). 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.

My config is:
resolvers dns
nameserver bobs-dns-server 10.0.xxx.xxx:53
#parse-resolv-conf
hold valid 10s
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold other 30s
hold refused 30s
hold nx 30s
hold timeout 30s
hold obsolete 30s

You can also see that I have the #parse-resolv-conf commented out because I wanted to use that, but I am getting the same result. I know the DNS works, I know it continues to work. The server IP’s dont change (its on-prem servers). I can hard code the IP’s but really dont want to.

Any help would be great!

The reason because it fails only after 10 seconds is because at startup libc resolution is used, which doesn’t use the resolver, and afterwards the actual configured resolver is used, which fails for a reason we have to establish.

You only need the resolver if the server IPs keep changing. If the servers IPs don’t change, than just use libc resolution and don’t bother with the internal haproxy resolver.

Otherwise, you’d have to share capture of the DNS traffic so that we can take a look at why haproxy doesn’t like the response.

Ah that explains it. I was having trouble wrapping my head around libc. I think this resolves my issue for now. Thank you!