What is the correct sequential order of administrative steps to configure GKE Workload Identity so that a Pod running in a Kubernetes namespace can access Google Cloud APIs using a dedicated Google Service Account?
- 1Create the Google Service Account (GSA) and grant it the necessary IAM roles for the Google Cloud resources.
- 2Create the Kubernetes Service Account (KSA) in the specific GKE cluster namespace where the application workload runs.
- 3Add an IAM policy binding granting the Workload Identity User role (roles/iam.workloadIdentityUser) on the GSA to the KSA principal.
- 4Annotate the Kubernetes Service Account (KSA) with the email address of the target Google Service Account (GSA).
Cevap
The correct sequence begins by creating the Google Service Account (GSA) with required GCP resource permissions, followed by creating the Kubernetes Service Account (KSA) in the cluster namespace, then adding the IAM policy binding to grant roles/iam.workloadIdentityUser to the KSA on the GSA, and finally annotating the KSA with the GSA email address.
To successfully establish GKE Workload Identity, the GCP service account (GSA) and Kubernetes service account (KSA) must first exist. The GSA must be configured with an IAM binding granting roles/iam.workloadIdentityUser to the KSA principal (`serviceAccount:PROJECT_ID.svc.id.goog[NAMESPACE/KSA_NAME]`). Lastly, the KSA in Kubernetes must be annotated with `iam.gke.io/gcp-service-account=GSA_EMAIL` so the GKE metadata server injects short-lived credentials into Pods running with that KSA.
Adım Adım Çözüm
Anahtar Kavram
Configuring GKE Workload Identity requires creating both Google and Kubernetes service accounts, granting roles/iam.workloadIdentityUser to link the KSA to the GSA, and annotating the KSA with the GSA email address.