尽管实例数增加,ECS 仍无法放置任务

ECS unable to place task despite increasing instance count

我在创建新实例的同时增加所需的容器数量时遇到了以下问题。由于实例不是 运行 当我增加所需的计数时,我得到 "service XXX was unable to place a task because no container instance met all of its requirements."。几秒钟后,新实例启动了,但是,集群仍然有 "Desire count: 30, Pending count: 0, Running count: 3"。换句话说,集群没有"know"有新的实例,没有创建新的容器。

如何避免这种情况?是否有参数指示集群监控实例计数,而不是在所需计数增加后立即监控?

在这种情况下,这是 ECS 的预期行为,原因是 ECS 服务调度程序包括 circuit breaker logic,如果任务反复启动失败,它会限制任务的放置频率。

When a new container instance in spined up it takes some time to get register to the Cluster and it looks like service is getting throttled because time taken from increase in desired count to registration of container instances to the cluster.

话虽如此,如果您在扩展集群中的实例数量后等待约 15 分钟,服务调度程序将开始将任务放置在新的容器实例上。

为避免这种情况,ECS 集群应根据 Custer 预留指标自动扩展,这样 ECS 集群将预先有额外的容量来容纳新的任务数。

这里是 tutorial 扩展 ECS 集群。