In Kubernetes, a CronJob creates Jobs on a predefined time schedule.
CronJob is meant for performing regular scheduled actions such as backups, report generation, and so on. One CronJob object is like one line of a crontab (cron table) file on a Unix system. It runs a Job periodically on a given schedule, written in Cron format.
The table presented here shows the following information:
- Name: the name of the CronJob.
- Schedule: the schedule in Cron format.
- Suspend: the value of the suspend CronJob spec. When
truethe scheduled execution is suspended.
- Active: the number of currently running Jobs.
- Last Schedule: information of when was the last time the Job was successfully scheduled. Manually launched CronJobs won't update this field.
- Age: the date when the CronJob was lastly deployed.
CronJob options menu
The Hamburger Menu, located on the last column of the table, allows to perform some actions on a CronJob. The available options are:
Inspecting a CronJob
By clicking on a CronJob name you can see some of the details about the CronJob.
Describe view you can find information about the selected CronJob in JSON format.
These details are the ones exposed by the Kubernetes APIs.
By clicking on the Launch manually button on the upper right side of the page you can trigger an immediate manual execution of the CronJob, as described in the next section here below.
Manually launching a CronJob
This feature is only available to users with sufficient permissions. For more information, consult the Console Levels and Permission Management section of the docs.
The Launch manually functionality triggers an immediate execution of the CronJob, regardless of its Schedule and Suspend values.
A modal will ask for confirmation for the action to be performed.
When manually scheduling a new Job from a CronJob, the Console will create a Kubernetes Job with the same
specs of the CronJob.
It also adds to the Job the following
When inspecting a Job, the presence of both the annotations suggests that the Job has been manually launched from a CronJob with the Console functionality.
The created Job name contains a random generated string and the timestamp of the execution, to avoid name conflicts.
To view the Job execution logs, you need to head to the Pods section, and inspect the logs of the Pod related to the launched Job.
Search for the Pod with the name of the Job as prefix.
To avoid excessive resource consumption, a Job launched from a CronJob is assigned a Time To Live (TTL) of one week. This means that the Job and the related Pod are marked for deletion after a week.
The deletion of the resources is permanent. Therefore, make sure to save elsewhere any important information that you may want to keep, such as Pod logs.