Interview Prep/Kubernetes/Configuration, Secrets and storage

How do you inject configuration into pods and what are the options?

BeginnerScenarioConfiguration, Secrets and storage
Answer

Situation read → A team asks how to pass settings to an app without baking them into the image.

What I'd do →

  1. Create a ConfigMap with kubectl create configmap app-config --from-file=app.properties
  2. Consume it as env vars with envFrom or valueFrom.configMapKeyRef
  3. Or mount it as files under volumes and volumeMounts
  4. Remember env vars need a pod restart, while mounted files update eventually
  5. Keep secrets in Secret objects, not ConfigMaps

Why → ConfigMaps decouple config from images, so one image runs in every environment.

Interview tip → Mention that subPath mounts do not receive updates.

All Kubernetes questions Roadmap: Kubernetes core

More on Configuration, Secrets and storage