Quick revision
The short answer
I would split configuration into secrets and non-secret settings and give each one home: secrets in Vault or the cloud secret store, delivered to pods by a single agreed mechanism, and non-secret settings in ConfigMaps managed through GitOps, one source per environment. Config Server stays only for the services that truly need runtime refresh across many instances. On top of that we publish precedence and naming rules and give teams a tool that shows the effective configuration of any service.
What to remember
In this answer, we saw how to replace four inconsistent sources with a clear standard: secrets in a secret store delivered one agreed way, non-secret settings in GitOps-managed ConfigMaps with one source per environment, Config Server only where runtime refresh is a real need, a published precedence and naming rule, and Actuator-based tooling that shows each service's effective configuration.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would split configuration into secrets and non-secret settings and give each one home: secrets in Vault or the cloud secret store, delivered to pods by a single agreed mechanism, and non-secret settings in ConfigMaps managed through GitOps, one source per environment. Config Server stays only for the services that truly need runtime refresh across many instances. On top of that we publish precedence and naming rules and give teams a tool that shows the effective configuration of any service.
Why this question is asked
When every team picks its own way to configure services, the cost does not show up on day one. It shows up during an incident, when nobody can say where a value came from, or during an audit, when secrets turn out to sit in plain environment variables in a Git repository. Interviewers ask this design question to see whether we can bring order without forcing one tool on every case. In this answer, we will recap the four sources and what each is good at, separate secrets from ordinary settings, pick one home for non-secret configuration, decide where Config Server still fits, and then define the precedence, naming and tooling that make the standard usable.
1A Quick Recap of the Four Sources
Spring Boot can read configuration from many places at once and merges them into one Environment, with a fixed order of precedence. That flexibility is why teams drifted apart. Each of the four sources in the question has a real strength, so it helps to name them before choosing.
| Source | Good at | Weak at |
|---|---|---|
| Spring Cloud Config | runtime refresh, one Git repo for many services | extra server to run; Spring only |
| Kubernetes ConfigMap | native, versioned with the deployment | changes need a restart to apply safely |
| Vault / cloud secret store | secrets: access control, audit, rotation | not meant for ordinary settings |
| Environment variables | simple, works in every language | no structure; easy to leak secrets |
2Separate Secrets From Ordinary Settings
The first rule is that secrets, meaning passwords, API keys, tokens and private keys, never live in the same place as ordinary settings. They need different things: access limited to the service that uses them, an audit trail of who read them, and rotation. Vault, AWS Secrets Manager, Azure Key Vault or Google Secret Manager provide that. A ConfigMap or a Git repository does not.
We then choose one delivery mechanism for secrets across the platform, so every team does it the same way. Common choices are the External Secrets Operator, which copies secrets from the store into Kubernetes Secrets, the Secrets Store CSI driver, which mounts them as files in the pod, or Spring Cloud Vault, which reads them from inside the application. The first two keep the application unaware of where secrets come from and work for non-Java services too, which is why I would usually prefer them for a mixed platform. Pods authenticate to the store with their Kubernetes service account identity, never with a static token.
3One Home for Non-Secret Configuration
For ordinary settings, the goal is that each value has exactly one source per environment. On Kubernetes, the natural home is a ConfigMap kept in Git and applied by a GitOps tool such as Argo CD or Flux. The change is then reviewed, versioned with the deployment, and rolled out like code. When a ConfigMap changes, a checksum annotation on the deployment triggers a rolling restart, so new values arrive gradually and readiness probes can stop a bad change.
Notice that the application reads plain files. It does not know about Kubernetes, which keeps local development and tests simple: the same file can sit in the project for a developer's laptop. Environment variables remain allowed, but only for a short, documented list of values that the platform injects, such as the environment name or the region.
4Where Config Server Still Fits
Config Server is not wrong, but it is an extra system with its own availability and its own failure mode, as many teams have learned with broadcast refreshes. I would keep it only where a group of services has a real need to change settings at runtime without restarts across many instances, and where those settings are validated and rolled out carefully.
For most of those needs, there is a better tool today: a feature flag service handles switches with targeting and gradual rollout, and a rolling restart handles everything else in a few minutes. So the standard says that new services start with ConfigMaps and the secret store, and that a team that wants Config Server explains why. Existing Config Server users migrate when they next touch their configuration, not in a big bang.
5Precedence, Naming and Seeing the Effective Configuration
A standard only helps if people can predict the result. We publish one precedence rule, from lowest to highest: defaults in the application's own application.yml, then the environment's ConfigMap, then secrets, then the few platform environment variables. Names follow a pattern such as <service>.<area>.<setting> for application settings, and secrets are mounted under one path, so nobody wonders whether DB_PASSWORD or spring.datasource.password wins.
Finally, we give teams a way to see the effective configuration of a running service. Spring Boot Actuator's /actuator/env and /actuator/configprops endpoints show each property and the source it came from, with values masked by default (check your version; Boot 3 masks values unless configured otherwise). Exposed only on the internal management port, with secrets masked, and wrapped in a small platform tool or dashboard, this answers the incident question in one query.
- Platform environment variablesregion, environment name: a short fixed list
- Secretsfrom the secret store, mounted as files
- Environment ConfigMapGitOps-managed, one per service per environment
- Application defaults
application.ymlinside the jar
4 layers, from the top down. Step through them one at a time.
A value always has one predictable winner.
6Follow-up questions
Why not put everything in Config Server, since some teams already use it?
Because it covers only Spring services, adds a server whose outage can block startups, and is weak for secrets. A ConfigMap and a secret store work for every language on the platform and come with Kubernetes and the cloud already. Config Server earns its place only where runtime refresh at scale is a real requirement.
Environment variables or mounted files for secrets?
Mounted files are usually safer. Environment variables are visible to any process in the container, show up in crash dumps and are easy to log by accident. Spring Boot reads mounted files with the configtree: import, which turns each file into a property.
How do we move existing teams to the standard?
Publish the standard with a starter and a template repository, add a check in CI that warns about secrets in ConfigMaps or plain environment variables, and migrate service by service when teams change their configuration anyway. Track progress per service so the remaining exceptions are visible.
7Conclusion
In this answer, we saw how to replace four inconsistent sources with a clear standard: secrets in a secret store delivered one agreed way, non-secret settings in GitOps-managed ConfigMaps with one source per environment, Config Server only where runtime refresh is a real need, a published precedence and naming rule, and Actuator-based tooling that shows each service's effective configuration.
Open with
I would start by separating secrets from everything else, because they need different properties. Secrets go to Vault or the cloud secret store, and we pick one delivery mechanism for the whole platform, for example the External Secrets Operator or the Secrets Store CSI driver, with pods authenticating through their service account identity and never a static token.
Then, if they want more
Non-secret configuration gets one home per environment, which on Kubernetes I would make ConfigMaps kept in Git and applied through GitOps, mounted as files that Spring Boot imports. A change then rolls out as a rolling restart, so readiness probes can stop a bad value.
I would keep Config Server only where a team really needs runtime refresh across many instances, and new services would start without it, since feature flags and rolling restarts cover most of those needs.
Then the important part: a published precedence order, application defaults, then the ConfigMap, then secrets, then a short list of platform environment variables, plus a naming convention, so anyone can predict which value wins.
And I would give teams tooling to see the effective configuration of a running service, built on Actuator's env and configprops endpoints with secrets masked, so during an incident nobody has to guess where a value came from. Migration happens service by service, with a CI check that flags secrets in the wrong place.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Cloud documentation, Resilience4j documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your platform runs on Kubernetes. Teams use Spring Cloud Config, ConfigMaps, Vault and...": https://scrivio-interview-library.netlify.app/spring-boot/spring-cloud/0e5a6a9826/