Secrets Management
Store, distribute, rotate and audit credentials without embedding them in code or pipeline configuration.
IntermediateSecrets ManagementIdentityCloudInfrastructure
Where it fits in the lifecycle
- Plan
- Code
- Build
- Test
- Release
- Deploy
- Operate
- Monitor
- Code Static analysis, secret detection and secure coding practices.
- Deploy Policy enforcement, admission control and infrastructure security.
- Operate Runtime security, secrets rotation and configuration reconciliation.
Overview
A secrets manager becomes the single source of truth for credentials. Applications and pipelines authenticate with a workload identity and receive short-lived secrets, ideally generated on demand rather than stored.
Why it matters
Static credentials scattered across CI variables and config files cannot be rotated confidently. Centralisation makes rotation, revocation and audit possible.
How it works
- 01Workloads authenticate using platform identity (Kubernetes service account, OIDC, cloud IAM).
- 02The secrets engine issues a lease-bound credential.
- 03Applications refresh before expiry; revocation is immediate and central.
- 04Every issuance and access is logged for audit.
Common tools
HashiCorp VaultExternal Secrets OperatorAnsible VaultSOPSVaultKubernetesAWSAnsible
Implementation examples
yamlExternal Secrets Operator sync
apiVersion: external-secrets.io/v1beta1kind: ExternalSecretmetadata: name: payments-dbspec: refreshInterval: 1h secretStoreRef: name: vault-backend kind: ClusterSecretStore target: name: payments-db-credentials data: - secretKey: password remoteRef: key: database/payments property: passwordbashEncrypt variables with Ansible Vault
ansible-vault encrypt_string 's3cr3t' --name 'db_password'Best practices
- Prefer dynamic, short-lived credentials over long-lived static ones.
- Bind secret access to workload identity rather than a shared token.
- Alert on unusual access patterns, not just failed reads.
Common mistakes
- Syncing secrets into environment variables that get logged.
- Using one shared service account for every workload.
Hands-on labs
- Lab 02 — Detect Committed Secrets
Use Gitleaks to find a secret committed to git history and practise the response.
- Lab 09 — Secure an Ansible Automation Workflow
Lint Ansible content, remove plaintext secrets and keep sensitive values out of job output.