HashiCorp Vault Integration
What you'll learn: How to configure a SecretStore to securely pull secrets from HashiCorp Vault into Kubernetes using different authentication methods.
Why HashiCorp Vault?
Vault is a powerful secrets management tool that stores sensitive data centrally and provides fine-grained access control. When integrated with Kubernetes through External Secrets Operator, Vault becomes your single source of truth for secrets, eliminating the need to store them directly in your cluster.
Setting Up SecretStore for Vault
A SecretStore tells External Secrets Operator how to connect to Vault. You must configure the Vault server address and choose an authentication method:
Kubernetes Auth (Recommended)
Vault verifies your Pod's identity using Kubernetes ServiceAccount tokens. This method leverages your cluster's native RBAC:
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
name: vault-backend
spec:
provider:
vault:
server: "https://vault.example.com"
path: "secret"
auth:
kubernetes:
mountPath: "kubernetes"
role: "my-app-role"
serviceAccountRef:
name: my-app-sa
AppRole Auth
Uses a role ID and secret ID pair for authentication—useful for automated systems:
auth:
appRole:
path: "approle"
roleId: "my-role-id"
secretRef:
name: vault-approle-secret
key: secretId
Token-Based Auth
Uses a static Vault token stored in a Kubernetes Secret—simplest but requires manual token rotation:
auth:
tokenSecretRef:
name: vault-token
key: token
Choosing Your Method
Kubernetes auth is most secure for Pod workloads. AppRole suits CI/CD pipelines. Token-based is quick for testing but avoid in production.
Key Takeaway: HashiCorp Vault integration requires configuring a SecretStore with your Vault server address and an authentication method—Kubernetes auth leverages ServiceAccounts, AppRole uses role credentials, and token-based uses static tokens.