I have 4 worker
nodes and 1 master
in kubernetes cluster. I made daemon-set
deployment from the master and it starts its pods on all the worker nodes. I have script which keeps running in background which basically monitors a git
repository and checks if needs to be pulled. If yes, then it pulls new changes to local. Pods can only read the local files at once when it starts and then keep using those configuration. I want to somehow restart the pod on that worker so that it picks up the new changes.
Is there any way, we can notify about the new changes to the master so that master can restart the pod.? or
Master can keep track of the git
repo and send the new changes to that worker as well as restart the pod.?
Is there any other way of achieving this functionality. ?
Setting a CronJob on a master node and creating a persistent volume which would be shared between the pods might help. This way all that happens on the master would be passed to the pods, and the pods would be able to read the configuration file from the volume. You can find an example of CronJob in Kubernetes documentation.
It would be better to follow the containerization philosophy to set up CI/CD tools (for example Jenkins/Bamboo/TeamCity) to automate this. They have built-in functions that would perform the tasks you need.