根据官方kubernetes 文档,为了让您的节点能够访问 AWS ECR,需要将以下标志添加到~/.kube/config
:
iam:
allowContainerRegistry: true
legacy: false
然后,更新集群后,应将以下权限添加到您的 ec2 实例:
{
"Sid": "kopsK8sECR",
"Effect": "Allow",
"Action": [
"ecr:BatchCheckLayerAvailability",
"ecr:BatchGetImage",
"ecr:DescribeRepositories",
"ecr:GetAuthorizationToken",
"ecr:GetDownloadUrlForLayer",
"ecr:GetRepositoryPolicy",
"ecr:ListImages"
],
"Resource": [
"*"
]
}
但是,我刚刚使用 AWS 在 AWS 上创建了一个集群,kops
并且我的节点已经拥有这些权限,而我没有做任何额外的配置工作。
这是正常的吗?
$ kops version
Version 1.8.0 (git-5099bc5)
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-11T23:27:35Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:17:43Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}