Secret Management Strategy
This project uses the External Secrets Operator to securely pull secrets from Bitwarden into the cluster. This means sensitive data never lives in Git.
Core Concepts
- Bitwarden as the Source of Truth: every token, password, and key lives in Bitwarden.
- External Secrets Operator: syncs those secrets into Kubernetes at runtime.
- Name based lookup follows a naming convention for secrets in Bitwarden:
Naming Convention
All Bitwarden secrets follow the {scope}-{service-or-app}-{description}
pattern.
{scope}
: high-level category likeinfra
,app
, orglobal
.{service-or-app}
: the specific component name (e.g.,argocd
,cloudflare
).{description}
: short purpose description such asapi-token
,oauth-client-id
, ordb-password
.
Example: the client ID for ArgoCD's OIDC setup is stored as app-argocd-oauth-client-id
.
Workflow for Adding a Secret
- Create the secret in Bitwarden: use the naming convention and store the value.
- Reference it in an
ExternalSecret
manifest: point theremoteRef.key
to the Bitwarden name. - Commit the manifest: once merged, ArgoCD applies it and the operator syncs the secret into the cluster.
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: newapp-secrets
namespace: newapp
spec:
secretStoreRef:
kind: ClusterSecretStore
name: bitwarden-backend
target:
name: newapp-k8s-secret
data:
- secretKey: API_KEY
remoteRef:
key: app-newapp-api-key
This setup keeps credentials out of the repository while keeping manifest files straightforward.