简体   繁体   English

如何将 GCP IAM 角色添加到服务帐号

[英]How to add GCP IAM roles to Service Account

I am trying to create a docker swarm node on a VM instance on GCP using docker-machine .我正在尝试使用docker-machine在 GCP 上的 VM 实例上创建一个 docker swarm 节点。

docker-machine create swarm-node -d google --google-machine-type e2-standard-2 --google-zone europe-north1-a --google-project myproject-name

I use a GCP Service Account in localhost docker-machine CLI.我在 localhost docker-machine CLI 中使用 GCP 服务帐户。

export GOOGLE_APPLICATION_CREDENTIALS="/home/my-name-here/.gcp/path-to-my-service-account-keyfile.json"

But I got this error:但我收到了这个错误:

Error with pre-create check: "Project with ID \"myproject-name\" not found. googleapi: Error 403: Required 'compute.projects.get' permission for 'projects/myproject-name', forbidden"

How can I add compute.projects.get GCP IAM access to the GCP Service Account?如何将compute.projects.get GCP IAM 访问权限添加到 GCP 服务帐户?

Finally I figured out, as explained at: https://cloud.google.com/iam/docs/granting-changing-revoking-access最后我想通了,如解释: https : //cloud.google.com/iam/docs/granting-changed-revoking-access

  1. In the Cloud Console, go to the IAM page在 Cloud Console 中,转到 IAM 页面
  2. Click Add.单击添加。
  3. Enter the service-account email address (displayed in service-account dashboard).输入服务帐户电子邮件地址(显示在服务帐户仪表板中)。
  4. Select a role, in this case Compute Admin选择一个角色,在本例中为Compute Admin
  5. Click Save.单击保存。

Et voilà等等

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Docker 中使用 GCP 服务帐号 json 文件 - How to use GCP service account json files in Docker 有没有办法在 Docker swarm 中运行每个服务以使用不同的 IAM 角色运行 - Is there a way to run each service in Docker swarm to run with different IAM roles 如何从命令行部署具有多个机密且只能通过 1 个服务帐户运行的 GCP 功能 - How Can I Deploy A GCP Function from The Command Line WITH Multiple Secrets AND Only Runable Through 1 Service Account 将IAM服务帐户与Google / cloud-sdk官方图片一起使用 - Use an IAM service account with official google/cloud-sdk image 将 Storage Admin IAM 角色分配给我的服务帐户时出错 - Error when assigning the Storage Admin IAM role to my service account GCP Kube.netes 不使用服务帐户来拉取 docker 个图像 - GCP Kubernetes not using service account for pulling docker images 使用自定义服务帐号部署到 Cloud Run 失败并出现 iam.serviceaccounts.actAs 错误 - Deploying to Cloud Run with a custom service account failed with iam.serviceaccounts.actAs error Docker - 错误:无法从非 TTY 设备执行交互式登录(GCP 服务帐户) - Docker - Error: Cannot perform an interactive login from a non TTY device (GCP Service Account) Jenkins - gcp 实例 - 找不到 gcloud-service-account-secret-key.json - Jenkins - gcp instance - cant find gcloud-service-account-secret-key.json 创建新计算实例时 GCP 中的权限错误,但服务帐户确实具有权限 - Permission error in GCP when creating a new compute instance but service account does have permissions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM