Detecting a changed ConfigMap does not guarantee every live bean or connection has adopted the new value.
Spring Cloud Kubernetes reload: decide which changes need a restart
Separate detection from application
A route limit changes in a ConfigMap. Spring Cloud Kubernetes can detect changes and trigger a refresh, restart or shutdown strategy, depending on configuration and version. A refreshed @ConfigurationProperties bean may see a new value, but a connection pool created from the old setting may not. Refresh boundaries need an inventory of stateful beans.
Use a rollout for hard state
Credential rotations, TLS material and connection targets often deserve a controlled pod restart with readiness gating. If a watcher is used, grant only the resources and namespace it monitors. The default reload setting is disabled in current Spring Cloud Kubernetes documentation; do not build an operational promise around an unstated default.
Observe the change
Patch one ConfigMap key, wait for the configured detection path, then call a behavior endpoint on every replica. Verify old requests finish, new requests use the intended value, and the pod remains ready. Also delete a key and check fallback behavior rather than assuming refresh restores its old value.
Implementation sketch
spring:
cloud:
kubernetes:
reload:
enabled: true
monitoring-config-maps: true
monitoring-secrets: falseCost and verification
Event watchers hold API watches; polling produces repeated reads. Restarts trade brief capacity for a clean bean graph. Choose by measured change frequency and state ownership.
Common Mistakes
- Do not equate a watch event with a fully reconfigured application.
- Do not use live refresh for a bean that only reads configuration at construction time.
- Do not allow a rollout to drop readiness before in-flight work drains.
Read next
Spring Cloud Kubernetes config import: make source precedence explicit, Spring Cloud refresh: changed properties do not rebuild every dependency, Spring readiness during termination: stop routing before stopping dependencies.
Related boundary
Spring Cloud Kubernetes watcher scope: filter before broadcasting refresh
