amazon-ecs-agent icon indicating copy to clipboard operation
amazon-ecs-agent copied to clipboard

Task Health Status wrongly reported as HEALTHY

Open manikawnth opened this issue 1 year ago • 1 comments

Summary

Description

I've 3 containers running in a task (Fargate mode) and all are essential: true . Only two of the containers have Health checks and they're reported as Healthy and the 3rd container reported UNKNOWN.

However the overall task health is being reported HEALTHY.

I've skimmed through the source code to find the logic for Task status as reported in the AWS ECS docs. I found the ecs-agent/api/container/status has the Container Health logic but couldn't find the Task Health status in the corresponding .. /task/status. Is that logic built in ECS control plane?

Expected Behavior

Task status should be UNKNOWN

Observed Behavior

Task status reported as HEALTHY

Environment Details

Supporting Log Snippets

manikawnth avatar Feb 15 '24 22:02 manikawnth

Hello @manikawnth, thanks for the query! A bit more context on how we determine the task health checks, only containers that are marked as essential and have health check command in the task definition will be considered to determine the task health.

Only two of the containers have Health checks and they're reported as Healthy and the 3rd container reported UNKNOWN.

From what you've provided, it seems as though ECS is behaving as expected as the task status is only looking at two out of three containers. If you want to include the third container, I would recommend also configuring a health check within the task definition.

Please also refer to the following public doc for more info -> https://docs.aws.amazon.com/AmazonECS/latest/developerguide/healthcheck.html

Hope this helps!

mye956 avatar Apr 24 '24 17:04 mye956