A DevOps engineer must configure keyless authentication for a microservice deployed in a Google Kubernetes Engine (GKE) cluster. The microservice runs in the `analytics` namespace and needs to read objects from a Cloud Storage bucket using a Google Service Account (GSA). What is the correct sequence of steps to establish Workload Identity binding between the Kubernetes Service Account (KSA) and the GCP Service Account (GSA)?
- 1Create the Google Service Account (GSA) and assign it the Storage Object Viewer role (`roles/storage.objectViewer`) on the target Cloud Storage bucket.
- 2Create the Kubernetes Service Account (KSA) in the `analytics` namespace of the GKE cluster.
- 3Grant the `roles/iam.workloadIdentityUser` role on the GSA to the principal member formatted as `serviceAccount:PROJECT_ID.svc.id.goog[analytics/KSA_NAME]`.
- 4Annotate the KSA with `iam.gke.io/gcp-service-account=GSA_EMAIL` to complete the metadata binding for the GKE pod.
Cevap
The correct sequence of steps is: 1) Create the Google Service Account (GSA) and assign it the Storage Object Viewer role on the target bucket, 2) Create the Kubernetes Service Account (KSA) in the `analytics` namespace, 3) Grant the `roles/iam.workloadIdentityUser` role on the GSA to the principal member `serviceAccount:PROJECT_ID.svc.id.goog[analytics/KSA_NAME]`, and 4) Annotate the KSA with `iam.gke.io/gcp-service-account=GSA_EMAIL`.
Establishing Workload Identity requires provisioning the GCP IAM identity (GSA) and Kubernetes identity (KSA), granting `roles/iam.workloadIdentityUser` on the GSA to the KSA principal in the Workload Identity pool (`PROJECT_ID.svc.id.goog[NAMESPACE/KSA_NAME]`), and finally annotating the KSA with the GSA email so the GKE metadata server handles token exchanges.
Adım Adım Çözüm
Anahtar Kavram
Configuring Workload Identity Binding between GKE KSAs and GCP GSAs