aws / containers-roadmap

This is the public roadmap for AWS container services (ECS, ECR, Fargate, and EKS).
https://aws.amazon.com/about-aws/whats-new/containers/
Other
5.21k stars 317 forks source link

[ECS] [request]: Valid SRV qname for service discovery #448

Open sveniu opened 5 years ago

sveniu commented 5 years ago

Tell us about your request Add option to use the RFC 2782-compliant _service._proto.namespace SRV record qname format for ECS / Cloud Map. Currently the SRV qname format is identical to the A record format: service.namespace.

Which service(s) is this request for? ECS, Cloud Map (aka Service Discovery)

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? I'm trying to use HAProxy with ECS tasks as backends, but HAProxy will only try SRV resolution if the qname starts with an underscore. Therefore, the SRV records produced by ECS / Cloud Map cannot be used with HAProxy (or other services that rely on the spec format).

Are you currently working around this issue? The current work-around is to rely solely on A records, and to be very vigilant with DNS caching, re-lookups, etc.

coultn commented 5 years ago

Is there a reason why just naming your service in Cloud Map according to the RFC 2782 format won't work? There is no requirement that the service name in Cloud Map be the same as the name of the ECS service. So for example if your Cloud Map zone is .local, you can name your service _myservice._tcp and it will be DNS-resolvable as _myservice._tcp.local. This works with SRV records also. Please let me know if there is something I am misunderstanding!

eedwards-sk commented 5 years ago

Is there a reason why just naming your service in Cloud Map according to the RFC 2782 format won't work?

I just spent all night chasing down the same issue, and I can confirm that this is a valid workaround.

Perhaps it would be best to surface this somewhere in the documentation? I never, ever would have thought to just put the appropriate values directly into the service name.

TamasNo1 commented 4 years ago

I actually spend the night as well trying to find out why HAProxy does not resolve my SRV records generated by ECS service discovery, and yepp, it's the missing underscore prefix... After prefixing my service name with an underscore, it works perfectly.

coultn commented 4 years ago

FYI, we have added this to our documentation: https://docs.aws.amazon.com/cloud-map/latest/dg/services-values.html

mattjamesaus commented 3 years ago

I will add here that cloudmap / route 53 only returns at maximum 8 records which means HAProxy will remove instances from the pool when route 53 returns a different 8 IPs each time. (assuming you have more than 8 containers for one service)