how to refresh all kubernetes pods with actuator in spring boot config server how to refresh all kubernetes pods with actuator in spring boot config server kubernetes kubernetes

how to refresh all kubernetes pods with actuator in spring boot config server


When a Pod is replaced during a rolling upgrade it will get its config from the config server during startup. So a more k8s-native solution than getting the individual Pod and refreshing the Pod would be to do a no-op rolling upgrade as was suggested in the question How to recycle pods in Kubernetes

If you are changing config as part of a rolling upgrade and the problem relates to timing then you could use a post-start hook on the Pod to do an additional refresh.

Presumably what you are looking at doing otherwise is using a bash script that lists all the Pods and refreshes them, perhaps by doing a 'kubectl exec -it' to shell into the container and call refresh from within it. I can understand your concern that this is not very 'native' as it is quite manual and you would expect a more automatic solution with k8s or with the config server. Actually you sort of have to choose which 'native' approach you want as the config server's refresh-based approach is rather different from the k8s concept of a configmap and a rolling upgrade. (See e.g. https://dzone.com/articles/configuring-java-apps-with-kubernetes-configmaps-a ) A solution more native to the config server is to do messaging to alert the services that new config is available - see the links at the end of https://dzone.com/articles/spring-cloud-config-server-for-the-impatient