AWS Batch 处于特权模式 urllib3.exceptions.ConnectTimeoutError + botocore.exceptions.ConnectTimeoutError

问题描述 投票:0回答:1

我的特权模式下的 AWS Batch 作业存在以下 boto/botocore 问题:

TimeoutError: timed out
The above exception was the direct cause of the following exception:

urllib3.exceptions.ConnectTimeoutError: (<botocore.awsrequest.AWSHTTPConnection object at 0x7f858aa9b700>, 'Connection to 169.254.170.2 timed out. (connect timeout=2)')

botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL: "http://169.254.170.2/v2/credentials/f379b1f3-1673-43b3-9ae7-523b2534be77"

botocore.exceptions.MetadataRetrievalError: Error retrieving metadata: Received error when attempting to retrieve container metadata: Connect timeout on endpoint URL: "http://169.254.170.2/v2/credentials/f379b1f3-1673-43b3-9ae7-523b2534be77"

botocore.exceptions.CredentialRetrievalError: Error when retrieving credentials from container-role: Error retrieving metadata: Received error when attempting to retrieve container metadata: Connect timeout on endpoint URL: "http://169.254.170.2/v2/credentials/f379b1f3-1673-43b3-9ae7-523b2534be77"
  • 角色和政策看起来不错
  • 安全组允许所有出站流量

怎么了?

docker boto3 aws-batch botocore
1个回答
0
投票

将其添加到您的 Dockerfile 中

RUN update-alternatives --set iptables /usr/sbin/iptables-legacy
RUN update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

该问题源于不同 iptables 版本(旧版和 nftables)之间的混淆。

在部署默认为 iptables 的 nftables 的容器映像(例如基于 Ubuntu 22.04 的容器映像)时,AWS Batch 中会出现这种复杂情况。

在我们的示例中,AWS Batch 使用的容器映像被设置为在启动时启动 docker-in-docker,并激活 --privileged 标志以促进此操作。

docker 守护程序对 iptables 的内部利用会提示将 nftables 加载到主机操作系统内核上,从而破坏已建立的旧版 iptables 配置,包括 AWS ECS 代理所依赖的端口转发。

来源:https://repost.aws/questions/QUCFqv7OfoQlygJrmwfkJ24Q/various-aws-apis-fail-due-to-timeout

© www.soinside.com 2019 - 2024. All rights reserved.