Kubernetes for developers · Scenario
A ConfigMap change nobody picked up
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
You changed the payment timeout in the service's ConfigMap from 30 to 10 seconds and applied it. An hour later the pods still use 30 seconds. A teammate says, 'Just delete the pods.' What's going on, and what's the right way?
Then
Follow-ups the interviewer asks next
- Does the app read the value from an environment variable or a mounted file? Why does it matter?
- If it's a mounted file, when does the new value appear?
- The team uses Helm. How can a ConfigMap change roll the pods automatically?
- Is reloading config without a restart a good idea?
- How do you roll back a bad config change?
- Do Secrets behave the same?
The answer
What a strong answer covers
- Environment variables from a ConfigMap are set when the container starts and never change.
- Mounted files are updated by the kubelet after a delay (its sync period plus cache, often up to a minute or more), but never when mounted with
subPath; the app must notice and re-read the file. - Right way: treat a config change like a deploy.
kubectl rollout restart deployment/paymentsreplaces pods gradually with the usual rollout safety; deleting pods by hand can take too many down at once. - Helm: a checksum of the ConfigMap as a pod template annotation (
checksum/config), so any config change changes the template and triggers a rollout. Kustomize'sconfigMapGeneratoradds a hash to the name for the same effect. - Rolling back:
kubectl rollout undorestores the pod template, not the ConfigMap's contents if you edited it in place. With hashed names or Helm or GitOps, the old ConfigMap version comes back too. - Hot reload is fine for a few things (log level, flags) but risky in general: pods disagree for a while and half-applied settings are hard to debug. Use a feature-flag service for values that change often.
- Secrets behave the same way.
The red pen
Common traps
Avoid:"ConfigMaps update automatically everywhere"; editing ConfigMaps by hand in production with no record.
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.