tsc*_*ann 5 amazon-web-services aws-ecr
我正在使用 Fargate 启动 ECS 任务,容器在处于 PENDING 状态几分钟后最终处于 STOPPED 状态。状态提供以下错误消息:
CannotPullContainerError: context canceled
Run Code Online (Sandbox Code Playgroud)
我正在使用 PrivateLink 来允许 ECS 主机与 ECR 注册表对话,而无需通过公共互联网,这就是它的配置方式(无服务器语法增强 CloudFormation):
Properties:
PrivateDnsEnabled: true
ServiceName: com.amazonaws.ap-southeast-2.ecr.dkr
SubnetIds:
- { Ref: frontendSubnet1 }
- { Ref: frontendSubnet2 }
VpcEndpointType: Interface
VpcId: { Ref: frontendVpc }
Run Code Online (Sandbox Code Playgroud)
关于导致错误的原因有什么想法吗?
您是否还添加了 S3 端点?这是我的模板的工作片段,我能够通过 aws 支持解决该问题:
EcrDkrEndpoint:
Type: 'AWS::EC2::VPCEndpoint'
Properties:
PrivateDnsEnabled: true
SecurityGroupIds: [!Ref 'FargateContainerSecurityGroup']
ServiceName: !Sub 'com.amazonaws.${AWS::Region}.ecr.dkr'
SubnetIds: [!Ref 'PrivateSubnetOne', !Ref 'PrivateSubnetTwo']
VpcEndpointType: Interface
VpcId: !Ref 'VPC'
Run Code Online (Sandbox Code Playgroud)
对于 S3,您需要知道路由表是必要的 - 通常您希望使用与互联网网关相同的路由表,其中包含路由 0.0.0.0/0
S3Endpoint:
Type: 'AWS::EC2::VPCEndpoint'
Properties:
ServiceName: !Sub 'com.amazonaws.${AWS::Region}.s3'
VpcEndpointType: Gateway
VpcId: !Ref 'VPC'
RouteTableIds: [!Ref 'PrivateRouteTable']
Run Code Online (Sandbox Code Playgroud)
如果没有 cloudwatch 的端点,您将遇到另一个失败,这也是必要的:
CloudWatchEndpoint:
Type: 'AWS::EC2::VPCEndpoint'
Properties:
PrivateDnsEnabled: true
SecurityGroupIds: [!Ref 'FargateContainerSecurityGroup']
ServiceName: !Sub 'com.amazonaws.${AWS::Region}.logs'
SubnetIds: [!Ref 'PrivateSubnetOne', !Ref 'PrivateSubnetTwo']
VpcEndpointType: Interface
VpcId: !Ref 'VPC'
Run Code Online (Sandbox Code Playgroud)
编辑:私有路由表:
PrivateRoute:
Type: AWS::EC2::Route
DependsOn: InternetGatewayAttachement
Properties:
RouteTableId: !Ref 'PublicRouteTable'
DestinationCidrBlock: '0.0.0.0/0'
GatewayId: !Ref 'InternetGateway'
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3432 次 |
最近记录: |