我正在使用Gcloud来运行Prow (Continous Integration server)。我的一项工作是创建一个虚拟机,执行一些测试,然后删除该实例。我使用服务帐户创建虚拟机,运行测试。
#!/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实例。如何清理此列表?或者有没有可能根本不存储这些公钥?
发布于 2019-01-25 00:37:33
上面一种非常粗糙的方法对我来说很有效,那就是:
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的项目元数据中,我没有看到很多键。仅限:
公钥密钥: network-name...
https://stackoverflow.com/questions/53180624
复制相似问题