amazon-web-services - AWS 允许跨账户 EKS 集群从 ECR 拉取镜像
问题描述
概括:
我希望使 EKS 节点能够从不同 AWS 项目的 ECR 注册表中提取图像。我在所需的 ECR 存储库中创建了“AllowPull”策略,并将策略的主体设置为 EKS 集群角色的 ARN,但节点无法拉取映像。
应该如何制定策略以允许 EKS 集群中的所有节点从跨账户 ECR 存储库中提取?
尝试详情:
ECR 注册表资源名称为:
arn:aws:ecr:us-east-2:226427918358:repository/external-pull-test
需要拉取镜像的 EKS 集群附加了以下角色:
arn:aws:iam::02182452XXXX:role/aws-dev-eks-cluster-crpiXXXX091410594876160000000c
外部 ECR 注册表具有以下策略 JSON:
{ "Version": "2008-10-17", "Statement": [ { "Sid": "AllowPull", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::02182452XXXX:role/aws-dev-eks-cluster-crpiXXXX091410594876160000000c" }, "Action": [ "ecr:BatchCheckLayerAvailability", "ecr:BatchGetImage", "ecr:DescribeImages", "ecr:DescribeRepositories", "ecr:GetDownloadUrlForLayer" ] } ] }
pod
ImagePullBackOff
错误指定尝试向注册表进行身份验证的用户是以下假定角色:arn:aws:sts::02182452XXXX:assumed-role/aws-dev-eks-cluster-crpiXXXX091410594876160000000c/i-0ea4f53b6dfdcxxxx
环境:
- Kubernetes:
v1.16.15-eks-e1a842
额外细节:
Using the ARN of my user principal (cross-account) in the policy did allow me to pull images using docker locally. Using the ARN of the assumed role did enable the node to pull the image, but my understanding is that configuring the policy with a particular assumed role won't guarentee that the cluster nodes can consistently pull from the registry.
解决方案
Another method is click on the "external-pull-test" repo on the ECR console, on the left panel under "Repositories" click on "Permissions", then click on "Edit" on the top right. You can add the account ID that needs to pull from this repo at "AWS account IDs". Check the permitted actions at the bottom "Actions" drop down box. "Save" and you should be able to pull.
推荐阅读
- python - 向 NSE 期权链 API 发送请求的正确方法是什么?
- android - 材质卡视图无法在 FadeThroughTransition 中正确加载。在样机应用程序中,他们做
- amazon-web-services - AWS - 网关负载均衡器目标内部故障
- javascript - 如何制作只有具有管理员和管理频道权限的成员才能使用的“创建文本/vc 频道”命令?
- python - 需要显示 tkinter 顶层窗口然后休眠;反过来发生
- node.js - NodeJS Express 和 EJS 使用 id 渲染路由
- javascript - 有什么方法可以绑定在加载 DOM 后创建的 div 并在 vanila JS 上添加事件?
- flutter - Flutter Getx - 更新子列表中的项目不是反应性的
- angular - 为什么在 Angular 单元测试中使用 overrideProvider 或 overrideComponent 来更改提供者依赖值?
- python - 如何在 python 库 pyppeteer 中保存带有浏览器 URL 的屏幕截图?