I am using the spring config server using the git backend as a property repository. I have deployed my application using k8s pods and there are multiple pods of my application. How do I make sure upon pushing new properties to bitbucket, all pods get refreshed?

Comment From: ryanjbaxter

There are multiple pods using using the config client?

Comment From: amit88265

Yeah. To be more precise, the Config server has one pod, and the config client (microservice getting properties from the config server) has multiple pods.

Comment From: ryanjbaxter

You will want to use Spring Cloud Bus to notify the apps via a message https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_push_notifications_and_spring_cloud_bus

Comment From: amit88265

Yeah, but is there a way without using a cloud bus or any third component?

One idea is to get all pod IPs using some k8s client lib and hit /actuator/refresh endpoint one by one.

is it a good way?

Comment From: ryanjbaxter

We have something that does something very similar to what you are trying to do in Spring Cloud Kubernetes https://github.com/spring-cloud/spring-cloud-kubernetes/tree/main/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher

The difference is that it monitors and calls the /refresh endpoint based on changes in ConfigMaps and Secrets. We could abstract that logic and also use it in the config server. It could get the POST request from the repository and then use the discovery client to get all service instances and call the /refresh endpoint of each instance. There could be something in the service metadata that points at the services actuator endpoint

Comment From: amit88265

Yeah, it seems a good solution. But problem with us is that we are not using discovery client.

Any way it looks like we have to implement the logic of this idea "One idea is to get all pod IPs using some k8s client lib and hit /actuator/refresh endpoint one by one."

Thanks for your help.