![](/img/trans.png)
[英]Compute Engine Linux Users and their relation to Service Accounts
[英]Using service accounts on Compute Engine instances
我正在尝试使用在Developers Console中创建的服务帐户在新的GCE实例上进行gcloud init
。 在开发人员控制台中,我在Permissions下看到了几个服务帐户,我无法为其生成私钥文件; 我还看到了在“服务帐户”下创建的服务帐户 , 可以为其获取私钥。
在GCE实例上执行gcloud init
时,在“选择要使用的凭据”下,我只能在“权限”选项卡中看到服务帐户(我没有私钥)。 我想使用拥有私钥的服务帐户。
我现在可以使用我的个人帐户登录,但这不能扩展。 有什么建议吗?
您可以使用gcloud auth auth activate-service-account命令通过服务帐户的私钥获取凭据。 有关更多信息和示例,请访问此链接 。
经过进一步讨论后,详细说明@Kamaran的答案。
基本解决方案是在GCE实例上启用服务帐户。
首先使用gcloud compute copy-files <private json key file> <instance name>:remote/path/to/key
将文件复制到远程实例。 然后在gcloud auth activate-service-account <service account address> --key-file remote/path/to/key
运行gcloud auth activate-service-account <service account address> --key-file remote/path/to/key
命令。 然后,新服务帐户将在gcloud init
菜单中可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.