我用服务帐户创建了一个google计算实例。
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"登录到实例
安装和配置对接机后。我尝试创建实例:
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
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有人能解释一下我做错了什么吗?
发布于 2017-11-20 07:39:27
有双重问题。
scope参数,无法获得特定的参数。
因此,安装docker+machine的实例可以很好地处理指定的sa。但是使用docker+machine创建的实例必须具有默认服务帐户。
在调试期间,我会关闭它。
因此我得到了这个错误。发布于 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,格式如下:
[SERVICE-ACCOUNT-NAME]@[PROJECT_ID].iam.gserviceaccount.com或者试试首先设置服务范围和帐户。
https://stackoverflow.com/questions/47227042
复制相似问题