2

Stackoverflow Service Discovery Translate: box in shopping feed Stories ship method Review + Maand

Hi,

I'm running 2 AWS ECS services (A and B) within the same cluster, using the Fargate launch type.

Service A should be able to connect to service B. This is possible using Service Discovery. I created a service discovery backend.local with the TTL of 15 seconds. The tasks in service B are added to a target-group which has a de-registration of 30 seconds.

+--------------+     +-------------+        +--------------+
| Application  +----->  ECS: A     +-------->  ECS: B      |
|    Load      |     +-------------+        +--------------+
|  Balancer    |     |   Task 1    |        |    Task 1    |
+--------------+     |   Task 2    |        |    Task .    |
                     +-------------+        |    Task n    |
                                            +--------------+

This is working perfect, from service A, I can do requests to http://backend.local, which are routed to one of the tasks in service B.

However, after a rolling deploy of service B, the service discovery DNS records aren't updated in time. So nslookup backend.local also returns IP addresses of the old tasks which are not available anymore.

The lifecylcle of tasks during deployment is:

  • New task: Pending -> Activating -> Running
  • Old task: Running -> Deactivating --> Stopped

I would expect that new task are discoverable AFTER they are 'Running', and not discoverable anymore when the target-groups de-registration delay kicks in.

How can I make sure that the Service Discovery doesn't make old tasks discoverable?

user1255553
  • 960
  • 2
  • 15
  • 27
  • just want to confirm if you have used ECS service discovery health check ? This will reduce the amount of time for unhealthy task to be removed from DNS – sayboras Dec 03 '19 at 09:19
  • I'm experiencing the same situation and I also expect that old task is removed from DNS as soon as it enters Deactivating state. However, DNS server is returning both old and new task records until old task is stopped. – Ignacio Alles Jul 14 '20 at 13:49

0 Answers0