如何解决 Amazon ECS 中的“[AWS service] was unable to place a task because no container instance met all of its requirements”错误?

2 分钟阅读
0

我想在 Amazon Elastic Container Service (Amazon ECS) 中放置一个任务。但是,我收到了以下错误:“[AWS service] was unable to place a task because no container instance met all of its requirements.”

简短描述

出现此错误,可能是因为以下一个或多个原因:

  • 未在集群中找到容器实例
  • 任务所需端口已在使用中
  • 内存不足,无法完成任务
  • 没有足够的 CPU 单元用于容器实例
  • 没有足够的可用弹性网络接口附加点
  • 您的容器实例缺少必需的属性

有关这些问题的更多信息,请参阅 Service event messages

**注意:**如果您没有收到前面的错误消息,请根据显示的以下错误消息选择相应的文章:

解决方法

**注意:**如果在运行 AWS CLI 命令时出现错误,请确保您使用的是最新版本的 AWS CLI

要解决错误,请根据您的用例选择解决方法:

ecs-cli check-attributes --task-def Task_Definition --container-instances Container_Instance --cluster Cluster_Name

注意: 对于 Task_Definition Name,输入任务定义的名称。对于 Container_Instance,输入容器实例的名称。对于 Cluster_Name,输入集群的名称。

  • 您可以将 Amazon ECS 服务配置为在与容器实例子网不同的子网上运行。在这种情况下,即使任务因缺失属性错误而失败,ecs-cli-check-attributes 命令的输出也会针对缺失的属性显示 None。确保您的服务和容器实例的子网匹配。为此,请在容器实例所在的子网中重新创建 Amazon ECS 服务。有关更多信息,请参阅 Task definition parametersAmazon ECS container agent configuration

例如,如果运行以下命令:

ecs-cli check-attributes --task-def task:1 --container-instances 650cf1df296749e1bce1b9e0cebb588a --cluster test-cluster

输出结果类似于:

Container Instance  Missing Attributes
tes-cluster         None

要了解更多信息,请运行以下命令:

ecs-cli --help

相关信息

Amazon ECS task networking

Service throttle logic

AWS 官方
AWS 官方已更新 1 年前