CronJob
最后更新于
最后更新于
Imagine a virtual timekeeper, ticking along to the Linux system's crontab, triggering particular tasks to run at the precise time designated. This is the idea behind 'CronJob'.
Kubernetes Version | Batch API Version | Activated By Default? |
---|---|---|
A word of caution: when executing APIs that aren't activated by default, users must configure --runtime-config=batch/v2alpha1
in the kube-apiserver.
.spec.schedule
outlines the schedule of task execution, akin to the Cron format.
.spec.jobTemplate
lists the tasks that need running, and mirrors the Job format.
.spec.startingDeadlineSeconds
specifies the deadline for initiating tasks.
.spec.concurrencyPolicy
delineates the policy for task concurrency, providing three options: Allow, Forbid, and Replace.
You can also use kubectl run
to create a CronJob:
v1.5-v1.7
batch/v2alpha1
No
v1.8-v1.20
batch/v1beta1
Yes
v1.21+
batch/v1
Yes