繁体   English   中英

具有 GitHub 操作的 Amazon ECS 卡在部署 ECS 任务定义上

[英]Amazon ECS with GitHub Actions Stuck on Deploying ECS Task Definition

我正在使用GitHub 操作模板的 Amazon ECS“部署任务定义”操作来部署我的应用程序。 有时会卡在这一步:

部署 Amazon ECS 任务定义

在终止之前,它可能会卡住很长时间,在 30 - 60 分钟之间 我能够登录到 ECS 中的 AWS 控制台并查看它创建的任务定义,然后从新创建的任务定义手动运行新任务。 结果很好,因为我看到任务成功运行。

当我查看日志以了解它最初为何卡住时,我看到了如下错误消息:

(service myService) 无法放置任务,因为没有容器实例满足其所有要求。 最接近的匹配(容器实例 id23244214)没有足够的可用 CPU 单元。

(service myService) 无法放置任务,因为没有容器实例满足其所有要求。 最接近的匹配(容器实例 id23244214)没有足够的 memory 可用。

我的 EC2 实例上有 2 个 vCPU 和 2 个 (GiB) memory,我的任务定义没有超过该限制 go。 由于我只能在 ECS 仪表板中创建任务,因此 EC2 实例似乎并不缺少 memory 或 VCPU。

最后,当我看到像上面两条这样的错误消息时,我尝试通过 GitHub 再次重新部署。GitHub 操作正常通过其所有作业,但它再次卡在任务定义步骤上。 然后,在 Amazon ECS 控制台中最后一次内存/cpu 分配不足后,我停止接收任何事件日志。

它最终失败并显示错误消息:

错误:资源不在 state 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": []
}

是什么原因造成的?

我有一个类似的错误(错误:资源不在 state servicesStable 中),在我增加任务定义中的 memory 后得到解决。 我的图像大小约为 600mb,直到我将任务定义 memory 更改为 2GB 后它才起作用。

暂无
暂无

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

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