--- name: gcp-gke-workload-identity description: | Implements Workload Identity for secure, keyless authentication between GKE pods and Google Cloud services. Use when setting up pod authentication to Pub/Sub, Cloud SQL, Secret Manager, or other GCP services. Eliminates service account key management, reduces security blast radius, and implements least privilege access patterns. Works with Spring Boot applications and IAM bindings. allowed-tools: - Bash - Read - Write - Glob --- # GKE Workload Identity ## Purpose Workload Identity enables GKE pods to authenticate to Google Cloud services without managing service account keys. Pods use short-lived, automatically rotated credentials based on IAM bindings between Kubernetes and GCP service accounts. ## When to Use Use this skill when you need to: - Set up secure authentication from GKE pods to GCP services (Pub/Sub, Cloud SQL, Secret Manager) - Eliminate service account key management and rotation - Implement least privilege access with IAM bindings - Authenticate Spring Boot applications to Google Cloud APIs - Reduce security blast radius by avoiding static credentials - Enable Cloud SQL Proxy or Pub/Sub client libraries to authenticate automatically Trigger phrases: "set up Workload Identity", "GKE authentication", "pod to GCP service auth", "keyless authentication", "Cloud SQL IAM auth" ## Table of Contents - [Purpose](#purpose) - [When to Use](#when-to-use) - [Quick Start](#quick-start) - [Instructions](#instructions) - [Step 1: Create Google Cloud Service Account](#step-1-create-google-cloud-service-account) - [Step 2: Create Kubernetes Service Account with Annotation](#step-2-create-kubernetes-service-account-with-annotation) - [Step 3: Bind KSA to GSA](#step-3-bind-ksa-to-gsa-one-time-iam-setup) - [Step 4: Grant Service Account Required IAM Roles](#step-4-grant-service-account-required-iam-roles) - [Step 5: Update Deployment to Use Service Account](#step-5-update-deployment-to-use-service-account) - [Step 6: Verify Workload Identity Configuration](#step-6-verify-workload-identity-configuration) - [Examples](#examples) - [Requirements](#requirements) - [See Also](#see-also) ## Quick Start Three simple steps to enable Workload Identity for your application: ```bash # 1. Create Kubernetes Service Account kubectl apply -f - <