April 2018
Intermediate to advanced
468 pages
14h 34m
English
Kubernetes cron jobs are jobs that run for a specified time, once or repeatedly. They behave as regular Unix cron jobs, specified in the /etc/crontab file.
In Kubernetes 1.4 they were known as a ScheduledJob. But, in Kubernetes 1.5, the name was changed to CronJob. Starting with Kubernetes 1.8, the CronJob resource is enabled by default in the API server and there no need to pass a --runtime-config flag anymore, but it's still in beta. Here is the configuration to launch a cron job every minute to remind you to stretch. In the schedule, you may replace the * with ?:
apiVersion: batch/v1beta1kind: CronJobmetadata: name: stretchspec: schedule: "*/1 * * * *" jobTemplate: spec: template: metadata: labels: name: stretch
Read now
Unlock full access