如何调试失败的Fargate任务初始化 [英] How to debug failed fargate task initialization
问题描述
我有一个计划要与CloudWatch Event规则一起运行的Fargate任务,并在成功运行时将时间戳输出到数据库。每次运行时,它还会向CloudWatch输出一个日志文件。
但是,有1次未创建日志文件且数据库未更新的情况。我怀疑任务从未启动过,或者启动失败。
在CloudWatch中,事件规则显示了我希望任务运行时的触发器和调用,所以我假设任务至少是尝试启动的。
我的问题是:有什么方法可以调试或记录有关无法启动任务的群集的信息? / p>
请让我知道是否需要提供更多信息。
编辑:我应该指定我在寻找以某种方式在某处的日志文件中读取此信息。我知道我可以在Web控制台中看到失败的任务原因,但这仅适用于相对较新的任务。
我在此处发布了相同的问题: https://www.reddit.com/r/aws/comments/adtqvt/debugging_failed_fargate_task_initialization/ 和StackOverflow: https://forums.aws.amazon.com/thread .jspa?messageID = 884638&#884638
- 转到群集并选择
任务
选项卡 - 在下面的窗格中,选择
Stopped
作为所需任务状态
值 - 找到所需的
任务
,然后单击其GUID - 向下滚动到
容器
部分,然后展开遇到错误的相关容器
您将看到错误的某种状态原因。在我的情况下是:
CannotStartContainerError:API错误(500):无法初始化日志记录驱动程序:无法确定awslogs驱动程序的区域
编辑:我真的不敢相信这一点-在这里找到了:
https:/ /github.com/aws/amazon-ecs-agent/issues/1654#issuecomment-437178282
I have a fargate task which I have scheduled to run with CloudWatch Event rules, and output a timestamp to a database on a successful run. It also outputs a logfile to CloudWatch for every time it runs.
However, there was 1 time where the log file was not created, and the database not updated. I suspect the task was never even started, or had failed to start.
In CloudWatch, the event rule shows trigger and invocation at the time I expected the task to run, so I assume the task at least attempted to start.
My question is: is there any way I can debug or log information about the cluster failing to start a task?
Please let me know if I need to provide more information.
Edit: I should specify I'm looking for a way to read this information in a log file somewhere. I know I can see failed task reason in the web console, but that's only for relatively recent tasks.
I have posted the same question here: https://www.reddit.com/r/aws/comments/adtqvt/debugging_failed_fargate_task_initialization/ and StackOverflow: https://forums.aws.amazon.com/thread.jspa?messageID=884638󗾞
- Go to the cluster and choose the
Tasks
tab - In the lower pane, choose
Stopped
for theDesired Task Status
value - Locate the desired
Task
and click it's GUID - Scroll down to the
Containers
section and expand the relevant containers that are experiencing errors
You'll see some kind of Status reason for the error. In my case it was:
CannotStartContainerError: API error (500): failed to initialize logging driver: Cannot determine region for awslogs driver
Edit: I can't really take credit for figuring this out - found it here:
https://github.com/aws/amazon-ecs-agent/issues/1654#issuecomment-437178282
这篇关于如何调试失败的Fargate任务初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!