如何将GCP角色添加到可授予的列表中?

发布于 2025-01-23 12:39:26 字数 804 浏览 0 评论 0原文

我正在尝试在GCP中设置一个服务帐户,以便我可以使用

Docker Pull

我的个人外壳和Google Cloud Shell中的

,在该外壳中自动起作用。我尝试了这一点:

gcloud projects add-iam-policy-binding myProject --member=serviceAccount:dockerdude --role=roles/container.admin

但是我发现了这个不太热心的错误:

错误:策略修改失败。对于具有条件的绑定,请运行“ GCLOUD ALPHA IAM策略绒毛条件”,以识别条件的问题。 错误:( gcloud.projects.add-iam-policy-bunding)invalid_argument:无效的服务帐户(Dockerdude)。

我发现这个问题:这个角色不是授予的 ...我使用了命令

gcloud iam list-grantable-roles 
         //cloudresourcemanager.googleapis.com/projects/myProject

...实际上,角色 container.admin 不在列表中。

我的问题:如何使这个角色授予?还是有其他方法可以获取我的想法( Docker Plul 用户外壳以及Google Cloud Cloud Shell的许可)?

非常感谢您对这个问题的任何见解!

I am trying to get a service account set up in GCP so I can use

docker pull

from my personal shell as well as from Google Cloud Shell, where it works automagically.

I tried this:

gcloud projects add-iam-policy-binding myProject --member=serviceAccount:dockerdude --role=roles/container.admin

But I got this not-very-helpful error:

ERROR: Policy modification failed. For a binding with condition, run "gcloud alpha iam policies lint-condition" to identify issues in condition.
ERROR: (gcloud.projects.add-iam-policy-binding) INVALID_ARGUMENT: Invalid service account (dockerdude).

I found the problem: this role isn't grantable ... I used the command

gcloud iam list-grantable-roles 
         //cloudresourcemanager.googleapis.com/projects/myProject

... and indeed the role container.admin isn't in the list.

My question: how do I make this role grantable? Or is there some other way to get what I'm looking for (docker pull permission from user shells as well as from Google Cloud Shell)?

Thanks much for any insight into this problem whatsoever!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自演自醉 2025-01-30 12:39:26

您可以使用此引用来交互方式编写您的命令,授予单一角色

注释:如果要在创建服务帐户之后识别它,请使用数字ID而不是电子邮件地址来确保其可靠地识别。

gcloud iam service-accounts add-iam-policy-binding ServiceAccount_ID \
    --member=PRINCIPAL --role=ROLE_ID \
    --condition=CONDITION

一些缺失的参数,但应该……

gcloud iam service-accounts add-iam-policy-binding [email protected] \
    --member=serviceAccount:[email protected] --role=/roles/container.clusterAdmin

还可以检查一下非常好服务帐户的说明可以将其描述为身份和资源,检查完整的问题以获取更多详细信息:

您必须像这样读取命令

  gcloud< resourceType> Add-am-Policy-Lting< resourcename> -member =< AccountTograntonTheresource> -  role =< rouletograntontheresource>
 

,请阅读此问题list> list-groltable-roles 命令:

也可以列出:

  gcloud IAM列表差异///cloudresourcemanager.googleapis.com/projects/projects/project_id_id
 

You can use this reference to write your command interactively, Granting a Single Role:

Note: If you want to identify a service account just after it is created, use the numeric ID rather than the email address to ensure that it is reliably identified.

gcloud iam service-accounts add-iam-policy-binding ServiceAccount_ID \
    --member=PRINCIPAL --role=ROLE_ID \
    --condition=CONDITION

Some missing parameters, but should be…

gcloud iam service-accounts add-iam-policy-binding [email protected] \
    --member=serviceAccount:[email protected] --role=/roles/container.clusterAdmin

Also check this very good explanation of the service accounts as they can be described as an identity and a resource, check the full question to get more details:

You have to read the command like this

gcloud <resourceType> add-iam-policy-binding <resourceName> --member=<accountToGrantOnTheResource> --role=<roleToGrantOnTheResource>

Additionally, read this question related to list-grantable-roles command:

They can also be listed:

gcloud iam list-grantable-roles //cloudresourcemanager.googleapis.com/projects/PROJECT_ID
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文