Pcornel
Containers · Kubernetes Configuration & Storage

ConfigMaps

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

Back to the Topic

Answer

ConfigMaps store non-secret configuration as key/value data, consumed as environment variables or mounted files.

Remember

Env vars are fixed at container start — restart to apply. Mounted files update after a delay (not with subPath). Use versioned names or checksum annotations to trigger rollouts.

First checks

  • kubectl get cm <c> -o yaml — 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

Commands

kubectl rollout restart

Verify in this order

ConfigMap → referenced by pod → env/file in container

Where it usually breaks

Putting passwords in a ConfigMap exposes them to anyone who can read ConfigMaps.

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

Confirmation

Confirm action

Continue?