DEV Community

Discussion on: Understanding Kubernetes: part 2 - CronJobs

Collapse
 
sunflower profile image
sunflowerseed

Can you tell us why cronjob is used instead of starting manually?

Collapse
 
aurelievache profile image
Aurélie Vache

A cronjob can be useful for recurring "jobs".
If you want to run automatically a program which retrieve images and export them in PDF, for example, it's possible in a cronjob.
You can schedule the cronjob.

Collapse
 
sunflower profile image
sunflowerseed

I mean, why run Kubernetes cronjobs? Why not just start it manually? Is it just to automate some task by invoking a pod?

Thread Thread
 
aurelievache profile image
Aurélie Vache

It's for automated tasks yes.

A cronjob scheduled every 10 minutes, will spawn a new pod every 10 minutes.

If a pod failed, you can watch the logs, analyze and understand why this case has failed.