I am having a list of pods running java applications,want to have a schedule restart of pods automatically.How it can be performed.I have tried with having a cron job inside an ocp file but it didn't work.
Help me with some suggestions
I am having a list of pods running java applications,want to have a schedule restart of pods automatically.How it can be performed.I have tried with having a cron job inside an ocp file but it didn't work.
Help me with some suggestions
If the CronJob didn't work, you likely need to authorize the ServiceAccount running the CronJob Pod to be able to list & delete the Java Pods. Otherwise it will lack the permissions to do so.
There are a long list of alternatives, but the constraints of your environment and the motivation to restart the applications would be important to understand to determine a good approach. Examples:
pod.spec.activeDeadlineSeconds. This will ensure the Pod terminates after running for the specified duration.