【发布时间】:2020-11-07 00:15:35
【问题描述】:
我在 TF (0.11.14) 中创建了一个 GCP 角色,将其附加到一个服务帐户,并为后者创建了一个密钥,如下所示:
resource "google_service_account_key" "my_service_account_key" {
service_account_id = "${google_service_account.my_service_account.id}"
}
然后我通过以下方式将private_key 作为输出:
output "my_service_account_private_key" {
value = "${google_service_account_key.my_service_account_key.private_key}"
sensitive = true
}
这会打印出很长的字符串,例如
ewogICJK49fo34KFo4 .... 49k92kljg==
假设角色具有对 GCS 存储桶进行读/写的权限,我如何将上述凭据/私钥传递给 (GKE) pod/部署,以便为 pod 授予特定的服务帐户(因此是能够执行相应权限允许的操作,例如读取/写入存储桶)?
【问题讨论】:
-
我的建议:忘记服务帐户密钥文件并使用workload identity feature
标签: google-cloud-platform google-kubernetes-engine google-iam