I have a requirement where need to restart only init container after applying changes, And make app container running. This process should be run every day at specific time.
Can any one has any suggestion how to achieve this.
I have a requirement where need to restart only init container after applying changes, And make app container running. This process should be run every day at specific time.
Can any one has any suggestion how to achieve this.
2
Answers
Why don’t you create a daily cronJob with this process?
This isn’t how initContainers work – you can’t restart one independently of the main containers.
Someone already suggested a daily cronJob.
My suggestion to consider is that you create a sidecar container that sleeps for a day, then runs the workload, then sleeps again.
If you ALSO need this to run before the main container first runs, duplicate it as an initContainer. If it’s acceptable to have it run in parallel to the main container starting then the sidecar container could well be enough by itself.