kubectl – Delete next kubernetes cronjob execution

kubectl gives you several different ways to update running configurations. The main ways are the apply, edit, and patch commands.

In this case you can use the kubectl patch command which allows you to change running configurations immediately.

You can run kubectl patch to add .spec.suspend: true to the cron job,then sleep 86400

From above we can suspend the cron job for 24 hrs

Please refer to this spec.suspend field and set it to true for more information

After that we have to disable it or it will delay for another 24 hrs and the cycle repeats. For re-enable, we should run the kubectl patch again to add .spec.suspend: false

Read more here: Source link