google-cloud-platform - Gcloud - 无法使用一个服务帐户配置多个 VM
问题描述
我正在使用 Gcloud 运行 Prow(持续集成服务器)。我的一项工作是创建一个虚拟机,执行一些测试,然后删除该实例。我使用服务帐户来创建 VM,运行测试。
#!/bin/bash
set -o errexit
cleanup() {
gcloud compute instances delete kyma-integration-test-${RANDOM_ID}
}
gcloud config set project ...
gcloud auth activate-service-account --key-file ...
gcloud compute instances create <vm_name> \
--metadata enable-oslogin=TRUE \
--image debian-9-stretch-v20181009 \
--image-project debian-cloud --machine-type n1-standard-4 --boot-disk-size 20 \
trap cleanup exit
gcloud compute scp --strict-host-key-checking=no --quiet <script.sh> <vm_name>:~/<script.sh>
gcloud compute ssh --quiet <vm_name> -- ./<script.sh>
一段时间后,我收到以下错误:
ERROR: (gcloud.compute.scp) INVALID_ARGUMENT: Login profile size exceeds 32 KiB. Delete profile values to make additional space.
实际上,对于该服务帐户,describe
命令会返回大量数据,例如sshPublicKeys
部分中的约 70 个条目。
gcloud auth activate-service-account --key-file ...
gcloud compute os-login describe-profile
这些公钥中的大部分都引用了已删除的 VM 实例。如何执行此列表的清理?或者是否有可能根本不存储该公钥?
解决方案
一种对我有用的非常粗略的方法是:
for i in $(gcloud compute os-login ssh-keys list); do echo $i; gcloud compute os-login ssh-keys remove --key $i; done
在删除了几十个键后,我停止了这个(使用 Control-C),然后它再次工作。
实际上,在 GUI 中的项目元数据中,我没有看到很多关键点。仅有的 :
- gke...cidr:网络名称...
- sshKeys:gke-e9 ...
- SSH 密钥 => peter_v : ssh-rsa 我的公钥
推荐阅读
- react-native - 反应原生地图没有被添加到项目中
- cloud - Spring Batch远程分区不起作用
- python - 绘制鼠标位置时不会触发Python activefill矩形
- powershell - AKS 在 PowerShell 中启动/停止群集
- java - CreateProcessAsUserW 进程未搜索 PATH
- django - 查看投诉页面上的投诉未显示
- node.js - 这是在 dynamoDB 中更新记录的正确方法吗
- android - Google 支付商家未启用直接令牌化
- wordpress - Wordpress 项目中的 Twig 和 scss:导入样式
- select - 在 nb-select 中选择选项时背景页面内容消失