A Job tracks the overall progress of a task and updates its status with information
about active, succeeded, and failed pods. Deleting a Job will clean up any pods it created.
Jobs are part of the Kubernetes API, which can be managed
with oc
commands like other object types.
There are two possible resource types that allow creating run-once objects in OpenShift Container Platform:
- Job
-
A regular Job is a run-once object that creates a task and ensures the Job finishes.
There are three main types of task suitable to run as a Job:
For more information about how to make use of the different types of Job, see Job Patterns in the Kubernetes documentation.
- CronJob
-
A CronJob can be scheduled to run multiple times, use a CronJob.
A CronJob builds on a regular Job by allowing you to specify
how the Job should be run. CronJobs are part of the
Kubernetes API, which
can be managed with oc
commands like other object types.
CronJobs are useful for creating periodic and recurring tasks, like running backups or sending emails.
CronJobs can also schedule individual tasks for a specific time, such as if you want to schedule a Job for a low activity period.
|
A CronJob creates a Job object approximately once per execution time of its
schedule, but there are circumstances in which it fails to create a Job or
two Jobs might be created. Therefore, Jobs must be idempotent and you must
configure history limits.
|