Open Java4all opened 5 years ago
@Java4all Can you please give us some more details about your services, their networking mode and the ports on each task? Do you have different clients discover and connect to different ports in the same ECS service?
Hi, It was an idea to use App Mesh design (non AWS) and Service discovery with SRV records. Some of services have up to 200 ports exposed per container (for example 5000-5200), and network mode is awsvcp. So registration of service should include all SRV records (container-port) in Route53. At the current state of app services, it is already sorted out by implementing of additional service discovery in env. However, why it cannot be in AWS SD?
Thanks @Java4all for the details. Agree that if the service has multiple ports open, they all need to be put into AWS Cloud Map for discovery.
Hello, I was wondering what's the status of this issue and when can we expect to see it rollout to CloudMap and ECS. We are in need to expose SRV records per ECS service with many container:port
combinations.
@jessie00chen Are you asking for different applications to be exposed for a single ECS service? For instance say I have a container that exposed webapp at 8080, redis at 9000, throttle-control at 6000, and gossip at 7200. These all being different applications but provided by the same Container. Or do you mean you have an identical webapp with instances available on different container:port combinations?
Hi @aws-gibbskt , I have a similar use case to @jessie00chen , but am looking for different port mappings for a single container to be exposed as srv records in cloudmap. One srv record per port mapping. like webapp-80.internal.domain:80, webapp-443.internal.domain:443, webapp-8080.internal.domain:8080
@yehudacohen Are you wanting the DNS name mything.mydomain.tld
to return 3 SRV records:
webapp-80.internal.domain 80
webapp-443.internal.domain 443
webapp-8080.internal.domain 8080
Or do you want 3 DNS names to return 1 record per instance like:
webapp-80.internal.domain ->
instance.ec2 80
instance2.ec2 80
webapp-443.internal.domain ->
instance.ec2 443
instance2.ec2 443
webapp-8080.internal.domain ->
instance.ec2 8080
instance2.ec2 8080
?
Hi @aws-gibbskt , I suppose the neatest solution would be similar to that offered by kubernetes natively: the ability to name ports and discover srv records using the name and the scheme. From kubernetes documentation:
Kubernetes also supports DNS SRV (Service) records for named ports. If the my-service.my-ns Service has a port named http with the protocol set to TCP, you can do a DNS SRV query for _http._tcp.my-service.my-ns to discover the port number for http, as well as the IP address.
So something like:
service_registries = [{
registry_arn = aws_service_discovery_service.registry.arn
container_name = "myapp"
container_port = 8080
port_service_name = "webserver"
},
{
registry_arn = aws_service_discovery_service.registry.arn
container_name = "myapp"
container_port = 8081
port_service_name = "websocket"
},
{
registry_arn = aws_service_discovery_service.registry.arn
container_name = "sidecar"
container_port = 80
port_service_name = "dashboard"
}
]
and this should publish three srv records. One at webserver.myservice.internal pointing to port 8080 of container myapp, one at websocket.myservice.internal pointing to port 8081 of container myapp, and one dashboard.myservice.internal pointing to port 80 of the sidecar
Summary
ECS Service Discovery doesn't create multiple values in SRV record for ECS service task
Description
There is possible to map only one value in SRV record for ECS Service Task and only one value will be registered in Service Discovery (Route53). Seems True for Bridge and AWSVPC modes
Expected Behavior
Enable multiple values in SRV record per ECS service tasks.
dig -t srv servicename.localdns
;; ANSWER SECTION: servicename.localdns. 60 IN SRV 1 1 5000 11-922-33-83ab-444.servicename.localdns. servicename.localdns. 60 IN SRV 20 20 5020 22-222-33-83-444.servicename.localdns. servicename.localdns. 60 IN SRV 30 30 5030 33-33-33-83-444.servicename.localdns.
Observed Behavior
Only one value for SRV record registered by Service Discovery per Service task
Environment Details
ECS, agent ver. 1.28.1
Supporting Log Snippets
a) From Service-Discovery-Considerations doc page: ...If you are using the Amazon ECS console, the workflow creates one service discovery service per ECS service. It maps all of the task IP addresses as A records, or task IP addresses and port as SRV records... b) Route53 supports RFC2782 https://tools.ietf.org/html/rfc2782 and it is possible to create multiple values in SRV record.