首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Docker-Machine不使用Google服务帐户

Docker-Machine不使用Google服务帐户
EN

Stack Overflow用户
提问于 2017-11-10 16:18:11
回答 2查看 1.2K关注 0票数 1

我用服务帐户创建了一个google计算实例。

代码语言:javascript
复制
gcloud --project my-proj compute instances create test1 \
--image-family "debian-9" --image-project "debian-cloud" \
--machine-type "g1-small" --network "default" --maintenance-policy "MIGRATE" \
--service-account "gke-build-robot@myproj-184015.iam.gserviceaccount.com" \
--scopes "https://www.googleapis.com/auth/cloud-platform" \
--tags "gitlab-runner" \
--boot-disk-size "10" --boot-disk-type "pd-standard" --boot-disk-device-name "$RESOURCE_NAME" \
--metadata register_token=mytoken,config_bucket=gitlab_config,runner_name=test1,gitlab_uri=myuri,runner_tags=backend \
--metadata-from-file "startup-script=startup-scripts/prepare-runner.sh"

通过ssh:gcloud compute --project "myproj" ssh --zone "europe-west1-b" "gitlab-shared-runner-pool"登录到实例

安装和配置对接机后。我尝试创建实例:

代码语言:javascript
复制
     docker-machine create --driver google --google-project myproj test2
    Running pre-create checks...
    (test2) Check that the project exists
    (test2) Check if the instance already exists
    Creating machine...
    (test2) Generating SSH Key
    (test2) Creating host...
    (test2) Opening firewall ports
    (test2) Creating instance
    (test2) Waiting for Instance
Error creating machine: Error in driver during machine creation: Operation error: {EXTERNAL_RESOURCE_NOT_FOUND  The resource '1045904521672-compute@developer.gserviceaccount.com' of type 'serviceAccount' was not found. []}

1045904521672-compute@developer.gserviceaccount.com是我的默认帐户。我不明白它为什么要用。因为激活是gke-build-robot@myproj-184015.iam.gserviceaccount.com

代码语言:javascript
复制
gcloud config list
[core]
account = gke-build-robot@myproj-184015.iam.gserviceaccount.com
disable_usage_reporting = True
project = novaposhta-184015
Your active configuration is: [default]

 gcloud auth list
                      Credentialed Accounts
ACTIVE  ACCOUNT
*       gke-build-robot@myproj-184015.iam.gserviceaccount.com

有人能解释一下我做错了什么吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-11-20 07:39:27

有双重问题。

  • 首先,坞机不能使用特定的服务帐户,至少在0.12和0.13版本中是这样。
  • Docker+Machine google驱动程序只有scope参数,无法获得特定的参数。 因此,安装docker+machine的实例可以很好地处理指定的sa但是使用docker+machine创建的实例必须具有默认服务帐户。 在调试期间,我会关闭它。 因此我得到了这个错误。
票数 2
EN

Stack Overflow用户

发布于 2017-11-13 20:33:07

一个类似的问题(博什-谷歌-cpi-发布第144期)表明

此错误消息不清楚,特别是因为也需要在清单中指定的凭据可能与另一个帐户完全关联。 如果bosh清单未主动设置,则bosh-google-cpi-release的默认bosh-google-cpi-release设置为"default“,因此无论何时使用service_scopes而不是service_account,都会发生这种情况。

当您不使用bosh-google-cpi-release时,最后一句让我重新检查参考页,特别是gcloud compute instance create

服务帐户是附加到实例的标识。它的访问令牌可以通过实例元数据服务器访问,并用于验证实例上的应用程序。 该帐户可以是电子邮件地址,也可以是对应于服务帐户的别名。可以使用“default”别名显式指定Compute默认服务帐户。 如果未提供,则实例将获得项目的默认服务帐户。

这就好像您的服务帐户被忽略或不正确(并且回到了项目的默认帐户)。

请参阅"为实例创建和启用服务帐户“以重复检查其值:

通常,服务帐户的电子邮件来自服务帐户ID,格式如下:

代码语言:javascript
复制
[SERVICE-ACCOUNT-NAME]@[PROJECT_ID].iam.gserviceaccount.com

或者试试首先设置服务范围和帐户

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47227042

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档