How do you manage configuration and secrets across many microservices?
⚡ Short Answer
Externalize config from code (12-factor): inject via environment variables / a config service (Spring Cloud Config, Consul) / Kubernetes ConfigMaps, and keep secrets in a secrets manager (Vault, AWS Secrets Manager / K8s Secrets) — never in the repo. Support per-environment overrides and, ideally, dynamic refresh.
☕Coffee Chat Question
Concept Made Simple
“How do you manage configuration and secrets across many microservices?”
🧠Mind Map Answer
Remember It Faster
🔥What If?
Think Beyond the Expected
A DB password is committed to the repo — what's the remediation?
Treat it as compromised: rotate the credential immediately, purge it from history (and assume it's leaked), then move it to a secrets manager injected at runtime. Add secret-scanning to CI to prevent recurrence. Rotating is non-negotiable — removing the commit doesn't un-leak it.
😂Real World
12-factor externalized config + a secrets manager is standard; the recurring incident is secrets committed to git, which is why secret-scanning and rotation policies exist.
🎯Interviewer's Expectation
Keywords they're listening for:
⚠️Common Mistakes
- ✗Hardcoding config/secrets in the repo
- ✗Same config across environments
- ✗Not rotating leaked credentials
✅Best Practices
- ✓Externalize all config; secrets in a manager
- ✓Per-environment overrides
- ✓Secret-scan CI + rotation policy
🔁Follow-up Questions
- 1Why is config in code an anti-pattern?
- 2How does dynamic config refresh work?
- 3How do K8s Secrets differ from a Vault?
🧩Related Technologies
Continue Learning with AI
Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly — AI is your learning companion, not a shortcut.
Plain-language foundations
I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner. Topic: Service Design (Microservices) Interview question: "How do you manage configuration and secrets across many microservices?" Please: 1. Explain the core idea in simple, plain language, using an everyday analogy. 2. Define any technical terms you use. 3. Walk through one small, concrete example. 4. Finish with a single sentence I can easily remember. Keep the tone friendly and assume I'm new to this topic.
Was this answer helpful?
⭐ Featured Products
Support our platform by exploring our recommended products.
As an Amazon affiliate, purchases through these links may earn us a small commission — at no extra cost to you. It helps keep Full Stack Interview Guru free.