0

We have springboot application running as a pod , it picks from application.properties from configmap. When we update configmap this change is not picked up springboot aplication , we need to restart the application to pick new property change. Can we do this without restarting the sringboot application pod to pick new properties.

1
  • I am not sure with configmap but I have used @RefreshScope with the config server. Commented Mar 7, 2022 at 11:52

2 Answers 2

1

No, ideally you can not do it, you need to restart the POD if you are using the config map.

However, you can set the auto reloader which will do work for you, whenever configmap will get updated it will auto restart the PODs of deployment so you won't need to manually restart the PODs.

You can read more about it here Reloader : https://github.com/stakater/Reloader

Or else

you can export the variable with this command however it not permanent solution

kubectl exec -it <pod_name> export VARIABLENAME=<value>
Sign up to request clarification or add additional context in comments.

Comments

0

The problem you are facing is that spring boot config doesn't know when to do a refresh of the config.

You have two options

  1. If you want to refresh whenever the config changes use spring cloud k8s watcher link to project

2. Restart the pod whenever config changes. There are many controllers available to do

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.