foc*_*691 10 amazon-ec2 amazon-ecs github-actions ecs-taskdefinition
我正在使用GitHub 操作模板的 Amazon ECS“部署任务定义”操作来部署我的应用程序。有时会卡在这一步:
部署 Amazon ECS 任务定义
在终止之前,它可能会卡住很长时间(30 - 60 分钟)。我可以登录 ECS 中的 AWS 控制台并查看它创建的任务定义,然后从新创建的任务定义手动运行新任务。结果很好,因为我看到任务成功运行。
当我查看日志以了解为什么它首先卡住时,我看到了错误消息,例如:
(service myService) 无法放置任务,因为没有容器实例满足其所有要求。最接近的匹配(容器实例 id23244214)没有足够的可用 CPU 单元。
(service myService) 无法放置任务,因为没有容器实例满足其所有要求。最接近的匹配(容器实例 id23244214)没有足够的可用内存。
我的 EC2 实例上有 2 个 vCPU 和 2 (GiB) 内存,并且我的任务定义没有超出该限制。由于我可以在 ECS 仪表板中创建任务,因此 EC2 实例似乎并不缺乏内存或 VCPU。
最后,当我看到类似上面两条的错误消息时,我尝试通过 GitHub 再次重新部署。GitHub Action 正常传递所有作业,但它再次卡在任务定义步骤上。然后,在 Amazon ECS 控制台中最后一次内存/CPU 分配不足后,我停止接收任何事件日志。
它最终失败并显示错误消息:
错误:资源未处于 servicesStable 状态
这是我的任务
{
"ipcMode": null,
"executionRoleArn": null,
"containerDefinitions": [
{
"dnsSearchDomains": null,
"environmentFiles": null,
"logConfiguration": null,
"entryPoint": null,
"portMappings": [
{
"hostPort": 80,
"protocol": "tcp",
"containerPort": 3000
}
],
"command": null,
"linuxParameters": null,
"cpu": 0,
"environment": [],
"resourceRequirements": null,
"ulimits": null,
"dnsServers": null,
"mountPoints": [],
"workingDirectory": null,
"secrets": null,
"dockerSecurityOptions": null,
"memory": null,
"memoryReservation": null,
"volumesFrom": [],
"stopTimeout": null,
"image": null,
"startTimeout": null,
"firelensConfiguration": null,
"dependsOn": null,
"disableNetworking": null,
"interactive": null,
"healthCheck": null,
"essential": true,
"links": null,
"hostname": null,
"extraHosts": null,
"pseudoTerminal": null,
"user": null,
"readonlyRootFilesystem": null,
"dockerLabels": null,
"systemControls": null,
"privileged": null,
"name": "container"
}
],
"placementConstraints": [],
"memory": "1957",
"taskRoleArn": null,
"family": "family",
"pidMode": null,
"requiresCompatibilities": [
"EC2"
],
"networkMode": null,
"runtimePlatform": null,
"cpu": "2048",
"inferenceAccelerators": null,
"proxyConfiguration": null,
"volumes": []
}
Run Code Online (Sandbox Code Playgroud)
可能是什么原因造成的?
小智 1
我遇到了类似的错误(错误:资源不在状态 servicesStable 中),在增加任务定义的内存后解决了该错误。我的图像大小约为 600mb,直到我将任务定义内存更改为 2GB 后才起作用。
| 归档时间: |
|
| 查看次数: |
6751 次 |
| 最近记录: |