简体   繁体   English

ECS 服务上的所有任务都卡在 PROVISIONING state

[英]All tasks on a ECS service stuck in PROVISIONING state

I'm trying to set up a service that launches 20 single-container tasks with an application load balancer.我正在尝试设置一项服务,该服务使用应用程序负载均衡器启动 20 个单容器任务。 The problem is that every task stays stuck on PROVISIONING问题是每个任务都停留在PROVISIONING

The service has logged an error saying that "service service_name is unable to consistently start tasks successfully", which does not seem very helpful since the documentation basically explains that the task launch failed and there were many retries.该服务记录了一个错误,指出“服务 service_name 无法始终成功地启动任务”,这似乎不是很有帮助,因为文档基本上解释了任务启动失败并且有很多重试。

My cluster is using an AutoScaleGroup capacity provider whose launch template is using an ecs-enabled AMI, with a role that has AmazonEC2ContainerServiceforEC2Role policy attached to it.我的集群正在使用 AutoScaleGroup 容量提供程序,其启动模板使用启用了 ecs 的 AMI,其角色附加了 AmazonEC2ContainerServiceforEC2Role 策略。 The instance type is t2.micro (tried t2.small with no results)实例类型是 t2.micro (尝试 t2.small 没有结果)

Can anybody help me troubleshoot this situation?有人可以帮我解决这种情况吗? May the task definition be a cause for this?任务定义可能是造成这种情况的原因吗? Thanks in advance提前致谢

At the end, I realized that each task must have an HTTP endpoint called /health that should return 200. By calling that endpoint, the load balancer determines whether the container is PROVISIONING or READY最后,我意识到每个任务都必须有一个名为 /health 的 HTTP 端点,它应该返回 200。通过调用该端点,负载均衡器确定容器是 PROVISIONING 还是 READY

So, you need an IAM role attached policy ecsInstanceRole to the LC to register the instance to the ecs cluster AND set the userdata to:因此,您需要一个 IAM 角色附加策略 ecsInstanceRole 到 LC 以将实例注册到 ecs 集群并将用户数据设置为:

#!/bin/bash
echo ECS_CLUSTER=YOU_CLUSTER_NAME_HERE >> /etc/ecs/ecs.config

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html

In my case the task was stuck in PROVISIONING state because the task definition required 16GB memory, but the AutoScaleGruping EC2 instances had only 15GB available.在我的情况下,任务卡在 PROVISIONING state 中,因为任务定义需要 16GB memory,但 AutoScaleGruping EC2 实例只有 15GB 可用。 I changed the memory in task definition to 15GB and I then I could start a task.我将任务定义中的 memory 更改为 15GB,然后我可以开始一个任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM