GCP Secret Manager Integration
You'll learn how to securely connect Kubernetes workloads to Google Cloud Secret Manager using Workload Identity and proper access controls.
What is GCP Secret Manager Integration?
Google Cloud Platform's Secret Manager is a centralized service for storing sensitive data like API keys, passwords, and certificates. Integrating it with Kubernetes (via External Secrets Operator) means your pods can fetch secrets dynamically from GCP instead of storing them directly in your cluster.
Core Integration Components
Workload Identity
Workload Identity is the recommended authentication method. It maps Kubernetes service accounts to Google service accounts, eliminating the need to store long-lived GCP credentials in your cluster. Think of it as giving your pod a temporary badge that GCP recognizes and trusts.
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
name: gcp-store
spec:
provider:
gcpsm:
projectID: "your-gcp-project"
auth:
workloadIdentity:
clusterLocation: us-central1
clusterName: my-cluster
serviceAccountRef:
name: my-k8s-sa
Service Account Keys (Less Secure Alternative)
For non-GKE environments, you can use service account JSON key files. Store the key as a Kubernetes Secret, then reference it in your SecretStore—but this approach requires managing and rotating credentials manually.
Access Control with IAM
Your Google service account needs the roles/secretmanager.secretAccessor IAM role to read secrets. This follows the principle of least privilege—grant only the minimum permissions necessary.
Key Takeaway: Use Workload Identity whenever possible for GCP Secret Manager integration—it provides secure, keyless authentication by mapping Kubernetes service accounts to Google service accounts, combined with IAM roles for fine-grained access control.