gpt4 book ai didi

kubernetes - 我需要为 GKE 节点池配置哪些最小权限才能从同一项目中的私有(private) GCR 存储库中提取?

转载 作者:行者123 更新时间:2023-12-04 18:56:10 24 4
gpt4 key购买 nike

我正在尝试将我的 GKE 集群配置为从同一项目中的私有(private) GCR 存储库中提取。我没有使用 OAuth 范围,但关联了 least privilege service account使用默认节点池并为其提供 roles/storage.objectViewer允许。

但是,在尝试访问此图像时,我仍然收到以下信息:
Failed to pull image "eu.gcr.io/<project>/<image>": rpc error: code = Unknown desc = Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

是否还需要配置 imagePullSecrets 或者应该 roles/storage.objectViewer许可就足够了吗?

最佳答案

此问题的根本原因是未在集群实例上设置访问 (OAuth) 范围,从而导致服务帐户无法按预期工作。
来自关于 Compute service accounts 的 GCP 文档:

You must set access scopes on the instance to authorize access.

You cannot set only IAM roles on the service account and omit access scopes when creating the virtual machine instance. The level of access a service account has is determined by a combination of access scopes and IAM roles so you must configure both access scopes and IAM roles for the service account to work properly.


在 GCR 中访问私有(private)图像时所需的最小范围可以找到 here找到这些范围的含义 here .然后可以按照说明 here 创建集群节点​​的最低权限服务帐户。 .
如所述 here另一种方法是只授予 https://www.googleapis.com/auth/cloud-platform范围到授权访问所有 Cloud Platform 服务的集群节点,然后通过节点服务帐户上的 IAM 角色限制访问。
通过如上配置集群节点, imagePullSecrets在同一项目中从 GCR 中提取私有(private)图像不需要。

关于kubernetes - 我需要为 GKE 节点池配置哪些最小权限才能从同一项目中的私有(private) GCR 存储库中提取?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53008125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com