如何更改 GKE 节点的服务帐户?

How to change service account for GKE nodes?

我的 GKE 集群是很久以前创建的,它有两个节点目前都使用默认服务帐户。 我现在想在不干扰集群的情况下更改节点的服务帐户。 我想为我们的集群维护一个单独的 SA。我找过,但它看起来像一个不可编辑的 属性.

有什么办法吗?

很遗憾,您无法修改已创建的 node-poolservice account

您可以在下面找到来自 Cloud Console 的屏幕截图,其中说明 service account 设置在创建过程中是永久性的:


为避免您的工作负载停机并创建具有不同 service account 的新 node-pool,您可以遵循有关迁移的官方文档:

This tutorial demonstrates how to migrate workloads running on a Google Kubernetes Engine (GKE) cluster to a new set of nodes within the same cluster without incurring downtime for your application. Such a migration can be useful if you want to migrate your workloads to nodes with a different machine type.

您将需要:

  • 用你的 service account 创建一个新的 node-pool
  • 将工作负载迁移到新的 node-pool(排空并封锁旧的 node-pool)。
  • 检查新 node-pool.
  • 上的所有内容是否 运行 正确
  • 删除旧的node-pool

其他资源: