A Cloud Engineer needs to securely configure a workload running on Google Kubernetes Engine (GKE) to access Cloud Storage using Workload Identity instead of downloading service account keys. Arrange the following configuration and deployment steps in the correct chronological order required to grant the GKE workload secure access to Cloud Storage.
- 1Create a Google Cloud IAM Service Account (GSA) and grant it the required IAM storage roles.
- 2Create a Kubernetes Service Account (KSA) within the target namespace of the GKE cluster.
- 3Add an IAM policy binding to grant the KSA the `roles/iam.workloadIdentityUser` role on the GSA.
- 4Annotate the Kubernetes Service Account with the email address of the Google Cloud IAM Service Account.
- 5Set `spec.serviceAccountName` in the Deployment manifest to the KSA and apply the manifest to the cluster.
Cevap
The correct chronological order to configure Workload Identity on GKE is: 1) Create the Google Cloud Service Account (GSA) and assign IAM roles, 2) Create the Kubernetes Service Account (KSA) in the cluster, 3) Bind the KSA to the GSA using the Workload Identity User role, 4) Annotate the KSA with the GSA email address, and 5) Reference the KSA under `spec.serviceAccountName` in the workload deployment manifest before applying it.
The correct sequence starts with provisioning the GCP identity (GSA) and cluster identity (KSA). Next, IAM impersonation trust is established by granting `roles/iam.workloadIdentityUser` to the KSA principal. The KSA is then annotated with the GSA email so the GKE metadata server can handle token exchange. Finally, the workload deployment manifest is configured to use the KSA and applied to the cluster.
Adım Adım Çözüm
Anahtar Kavram
GKE Workload Identity Configuration Sequence