1

Looking to migrate to using AWS Fargate to host a number of containers to be load balanced via HAProxy, it seems an elegant method to then use a combination of AWS Cloudmap for service discovery and then HAProxy DNS (server-template) syntax to autopopulate the backend servers.

However it's come to attention that route 53 the underlying system of Cloudmap only returns 8 A or SRV records at most which from HAProxy documentation makes it sound like it will continuously mark the nodes not returned in the latest DNS call to be marked as unhealthy which would lead to backends being constantly dropped and re-added to the HAProxy pool even if they're all healthy.

I can only assume this is something others have encountered before and if there's a trick to get ting HAProxy to accomodate for the maximum value of 8 backend servers?

Matt James
  • 182
  • 1
  • 1
  • 9

1 Answers1

2

HAProxy supports DNS service discovery with the server-template directive. Make sure you configure a resolvers section and use it with the resolvers directive on the server line. There's a blog post here. If you find that you need to accommodate more records you can adjust the accepted_payload_size size.

dcorbett
  • 452
  • 2
  • 2
  • Yeah except in the case of route 53 which is the resolver it only returns 8 records at most, so HA only populates 8 containers even if there is more. – Matt James Aug 12 '20 at 03:24
  • AWS Route53 docs say > If the resolver supports EDNS0 (as defined in RFC 2671), and advertises the EDNS0 option to Amazon Route 53, Route 53 permits responses up to 4096 bytes over UDP, without truncation. HAProxy does support EDNS0 - you will need to configure the accepted_payload_size size. – dcorbett Aug 12 '20 at 04:06
  • Thanks for the help here @dcorbett, we ended up using NLBs to work around this limitation of fargate, the other options we thought about was creating multiple pools of workers etc. NLB seemed the simplest. – Matt James Aug 19 '20 at 10:16
  • Have you kept looking for a workaround for the route53 8 register limit? NLB is not an option for us and the HAProxy server-template option looked really simple – Mihai Blidaru Jun 21 '22 at 07:53