Interview Prep/Kubernetes/Configuration, Secrets and storage

How do you store a database password safely in Kubernetes?

BeginnerScenarioConfiguration, Secrets and storage
Answer

Situation read → A repo contains a plain-text password in a manifest.

What I'd do →

  1. Rotate the exposed password immediately
  2. Store it with kubectl create secret generic db --from-literal=password=... or better through an external manager
  3. Use External Secrets Operator or the Secrets Store CSI driver with AWS Secrets Manager
  4. Mount as a file or env var in the pod
  5. Enable encryption at rest for etcd and restrict Secret RBAC

Why → Secrets are base64 encoded, not encrypted, so the real protection is encryption at rest, RBAC, and keeping values out of Git.

Interview tip → Say "base64 is not encryption" early.

All Kubernetes questions Roadmap: Kubernetes core

More on Configuration, Secrets and storage