Pcornel
Containers · Kubernetes Configuration & Storage

Secrets

Cheat sheet · https://pcornel.dk/topic.php?topic=6152

Back to the Topic

Answer

Secrets hold sensitive data (passwords, tokens, keys) base64-encoded, delivered as files or env vars; protected by RBAC and optional encryption at rest or external secret stores.

Remember

Base64 is not encryption — enable encryption at rest and restrict get secret via RBAC. Prefer mounted files over env vars. Consider External Secrets/CSI secret stores.

First checks

  • kubectl get secret <s> -n <ns> — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl logs <pod> [-c <c>] [--previous] — container logs (incl. previous crash)
  • kubectl get events --sort-by=.lastTimestamp — recent cluster events

Verify in this order

secret stored (encrypted at rest) → RBAC → mounted into pod

Where it usually breaks

Committing Secret manifests to Git exposes the base64 value.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6152

Confirmation

Confirm action

Continue?