A cloud engineer is tasked with deploying an application to a new Google Kubernetes Engine (GKE) cluster. The application must securely access Cloud Storage using Workload Identity instead of exported service account keys. The target Google Service Account (GSA) and its IAM permissions have already been created. In which chronological order should the engineer execute the steps below to set up the cluster, configure Workload Identity, and deploy the workload?
- 1Provision the GKE cluster with Workload Identity enabled via `gcloud container clusters create --workload-pool=PROJECT_ID.svc.id.goog`.
- 2Fetch cluster credentials and update `kubeconfig` using `gcloud container clusters get-credentials`.
- 3Create a Kubernetes Service Account (KSA) inside the cluster namespace using `kubectl create serviceaccount`.
- 4Grant the `roles/iam.workloadIdentityUser` role to the KSA principal on the GSA via `gcloud iam service-accounts add-iam-policy-binding`.
- 5Annotate the KSA with the GSA email address using `kubectl annotate serviceaccount` and deploy the workload manifest using `kubectl apply -f`.
Cevap
The correct sequence begins with provisioning the GKE cluster with Workload Identity enabled, fetching cluster credentials for kubectl, creating the Kubernetes Service Account (KSA), granting the IAM Workload Identity User role on the Google Service Account (GSA), and finally annotating the KSA and deploying the application manifest.
The proper deployment workflow requires creating infrastructure and establishing authentication boundaries before deploying application resources. First, provision the GKE cluster with Workload Identity enabled. Next, configure local cluster credentials with `gcloud container clusters get-credentials`. Third, create the Kubernetes Service Account (KSA) within the cluster. Fourth, bind the Google Service Account (GSA) to the KSA using `gcloud iam service-accounts add-iam-policy-binding` with `roles/iam.workloadIdentityUser`. Finally, annotate the KSA with the GSA email and deploy the workload manifest.
Adım Adım Çözüm
Anahtar Kavram
Workload Identity Configuration Sequence for GKE