Kubernetes: delete pod periodically

12/15/2018

I would like to delete a pod periodically, for example every day at 3:00 AM, or in the equivalent, scale down to zero and scale up to 1 again, either mechanism would be good.

What would be the most appropriate way to do this in kubernetes ?

-- jmhostalet
cron
kubernetes

1 Answer

12/15/2018

While kubernetes have two different resource for this kind of things, one is "cronjobs" which is native in kubernetes for repeat jobs like crontab in linux, and another things is "jobs" which is also native for one-time task.

Here is the related link.

https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/

And also for your scenario, you have to also solve some authorization things to make the cronjob can have right permission to do this.

-- c0rehe110
Source: StackOverflow