Skip to content

Commit 80e05e4

Browse files
Tim Bannisterzacharysarah
andcommitted
Improve CronJob concept page
Co-Authored-By: Zach Corleissen <[email protected]>
1 parent f85277d commit 80e05e4

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

content/en/docs/concepts/workloads/controllers/cron-jobs.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ weight: 80
1212

1313
{{< feature-state for_k8s_version="v1.8" state="beta" >}}
1414

15-
A _Cron Job_ creates [Jobs](/docs/concepts/workloads/controllers/jobs-run-to-completion/) on a time-based schedule.
15+
A _CronJob_ creates {{< glossary_tooltip term_id="job" text="Jobs" >}} on a repeating schedule.
1616

1717
One CronJob object is like one line of a _crontab_ (cron table) file. It runs a job periodically
1818
on a given schedule, written in [Cron](https://en.wikipedia.org/wiki/Cron) format.
@@ -27,14 +27,26 @@ The name must be no longer than 52 characters. This is because the CronJob contr
2727
append 11 characters to the job name provided and there is a constraint that the
2828
maximum length of a Job name is no more than 63 characters.
2929

30-
For instructions on creating and working with cron jobs, and for an example of a spec file for a cron job, see [Running automated tasks with cron jobs](/docs/tasks/job/automated-tasks-with-cron-jobs).
3130

3231
{{% /capture %}}
32+
{{% capture body %}}
3333

34+
## CronJob
3435

35-
{{% capture body %}}
36+
CronJobs are useful for creating periodic and recurring tasks, like running backups or
37+
sending emails. CronJobs can also schedule individual tasks for a specific time, such as
38+
scheduling a Job for when your cluster is likely to be idle.
39+
40+
### Example
41+
42+
This example CronJob manifest prints the current time and a hello message every minute:
43+
44+
{{< codenew file="application/job/cronjob.yaml" >}}
3645

37-
## Cron Job Limitations
46+
([Running Automated Tasks with a CronJob](/docs/tasks/job/automated-tasks-with-cron-jobs/)
47+
takes you through this example in more detail).
48+
49+
## CronJob limitations {#cron-job-limitations}
3850

3951
A cron job creates a job object _about_ once per execution time of its schedule. We say "about" because there
4052
are certain circumstances where two jobs might be created, or no job might be created. We attempt to make these rare,
@@ -66,3 +78,11 @@ The CronJob is only responsible for creating Jobs that match its schedule, and
6678
the Job in turn is responsible for the management of the Pods it represents.
6779

6880
{{% /capture %}}
81+
{{% capture whatsnext %}}
82+
[Cron expression format](https://pkg.go.dev/github.com/robfig/cron?tab=doc#hdr-CRON_Expression_Format)
83+
documents the format of CronJob `schedule` fields.
84+
85+
For instructions on creating and working with cron jobs, and for an example of CronJob
86+
manifest, see [Running automated tasks with cron jobs](/docs/tasks/job/automated-tasks-with-cron-jobs).
87+
88+
{{% /capture %}}

0 commit comments

Comments
 (0)