Eureka with AWS ECS

不问归期 提交于 2019-12-12 04:36:09

问题


We are using Eureka with AWS ECS service that can scale docker containers. In ECS if you leave out the host port, or specify it as being '0', in your task definition, then the port will be chosen automatically and reported back to the service. After the task is running, describing it should show what port(s) it bound to.

How does Eureka can resolve what port to use if we have several EC2 instance. For example Service A from EC2-A try to call Service B from EC2-B. So Eureka can resolve hostname , but cannot identify exposed port


回答1:


The issue was resolved https://github.com/Netflix/eureka/issues/937

Currently ECS agent knows about running port.

But I don't recommend to use Eureka with ECS, because Application Load Balancer does the same. It works as service registry and discovery. You don't need to run addition service(Eureka), ALB is cheap.




回答2:


There is another solution.

You can create an application loadbalancer and a target group, in which the docker containers can be launched.

Every docker container has set their hostname to the hostname of the loadbalancer. If you need a pretty url, then you can utilize Route53 for DNS-Routing.

It looks like this:

Service Discovery with Loadbalancer-Hostname

Request Flow

If you have two containers of the same task on different hosts, both will communicate the same loadbalancer hostname to eureka.

With this solution you can use eureka with docker on AWS ECS without loosing the advantages and flexibility of dynamic port mapping.




回答3:


Hi @Aleksandr Filichkin,

I don't think Application Load Balancer and service registry does the same. The main difference traffic flows over the (application) load balancer whereas the service registry just gives you a healthy endpoint that your client directly can address (so the network traffic does not flow over the service registry).

Cheap is a very relative term, maybe it's cheap for some, maybe it's an unnecessary overhead for others.



来源:https://stackoverflow.com/questions/43738905/eureka-with-aws-ecs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!