codegurukool.com · Free coding tutorials & online compiler

Home › Kubernetes Tutorial › Jobs and CronJobs

Jobs and CronJobs

Run tasks to completion or on a schedule.

A Job runs a Pod until it finishes successfully, which suits batch work. A CronJob creates Jobs on a schedule written like Linux cron: minute, hour, day, month, weekday.

Example code

kubectl create job hello-job --image=busybox:1.36 -- echo Hello
kubectl create cronjob hello --image=busybox:1.36 --schedule="*/5 * * * *" -- echo Hi

Run this code in the online editor

← Health probes and resource limitsRBAC and service accounts →