GCP Associate Cloud Engineer Practice Question 39: GKE Workload Identity
Google Cloud Associate Cloud Engineer · Test 4 · question 9 of 10
A pod on a GKE cluster must read objects from one Cloud Storage bucket. Other workloads on the same nodes must not gain that access, and the security team forbids service account keys. Currently, the nodes use the default Compute Engine service account, which has the Editor role.
How should you give only this pod access to the bucket?
Show answer and explanation
Answer:
Workload Identity Federation for GKE lets a Kubernetes service account act as an IAM principal (either by granting roles directly to the Kubernetes service account principal on the bucket, or by impersonating a Google service account). The pod authenticates with short-lived tokens, so there are no keys, and only pods that use that Kubernetes service account receive the access.
Option A grants access to every pod on the node, including the ones that must not have it. Option B uses a long-lived key, which the security team has prohibited and which can be copied out of the Secret. Option D widens the scope of access for the whole node and does not provide per-pod identity.
Reference: Workload Identity Federation for GKE