Skip to content

4.5. CronJobs

Overview

The CronJobs page manages every CronJob held on the MCM control plane in one place. A CronJob is the workload that creates and runs a Job periodically according to a cron schedule.

What it is for:

  • Managing multi-cluster CronJobs together
  • Running work automatically on a schedule
  • Tracking the Job creation history and status
  • Checking the PropagationPolicy and OverridePolicy

Where CronJobs are used:

  • Regular backups (a database backup every midnight)
  • Periodic report generation (a report every Monday)
  • Cache cleanup (deleting old cache entries hourly)
  • System health checks (a health check every 5 minutes)
  • Log rotation and cleanup

How the Screen Is Laid Out

The CronJobs page shows the CronJob list as a table.

The CronJobs main screen

The Elements at the Top of the Page

ElementDescription
Namespace filterShows only the CronJobs of a particular namespace
Refresh buttonRefreshes the CronJob list
Create buttonOpens the dialog for creating a new CronJob
Search boxSearches by CronJob name

Table Columns

ColumnDescriptionSortable
NameThe CronJob name
NamespaceThe namespace the CronJob belongs to
ScheduleThe cron expression and its description ("*/5 * * * *" -- every 5 minutes, for example)
StatusActive / Suspended
ImageThe container image name
Last ScheduleWhen a Job last ran
AgeThe time since the CronJob was created
ActionsThe edit and delete buttons-

How Status Is Shown

StatusDescriptionHow it is shown
ActiveThe CronJob is running normally on its scheduleA green badge
SuspendedThe CronJob's runs are suspendedA yellow badge

How the Schedule Is Shown

The Schedule column shows the cron expression together with a human-readable description:

  • */5 * * * * → "every 5 minutes"
  • 0 0 * * * → "every day at midnight"
  • 0 0 * * 0 → "every Sunday at midnight"

CronJob Detail

Clicking a CronJob row opens the detail panel.

CronJob detail

The Detail Panel Header

ElementDescription
CronJob nameThe name of the chosen CronJob
NamespaceThe namespace the CronJob belongs to
ScheduleThe cron expression (*/5 * * * *, for example)
StatusReady / Suspended

The Action Buttons

ButtonWhat it does
RefreshRefreshes the CronJob information
EditOpens the YAML edit mode
DeleteDeletes the CronJob

The Tabs

The Overview Tab

Shows the CronJob's basic information, schedule, and status.

Basic information:

ItemDescription
NameThe CronJob name
NamespaceThe namespace the CronJob belongs to
StatusReady / Suspended
AgeThe time since creation
CreatedWhen the CronJob was created

Schedule Info:

ItemDescription
ScheduleThe cron expression (*/5 * * * *, for example)
Schedule DescriptionThe human-readable description of the schedule (every 5 minutes, for example)
SuspendedYes / No
Concurrency PolicyAllow / Forbid / Replace
Starting Deadline (s)How long a Job creation may be delayed

CronJob Status:

ItemDescription
Last Schedule TimeWhen a Job was last scheduled
Last Successful TimeWhen a Job last succeeded
Active JobsThe number of Jobs running now

History Limits:

ItemDescription
Successful Jobs HistoryHow many successful Jobs to keep (default: 3)
Failed Jobs HistoryHow many failed Jobs to keep (default: 1)

Container images:

Shows the container images defined on the CronJob.

The Multi-Cluster Policies Tab

Shows the multi-cluster policies that apply to the CronJob.

The multi-cluster policies tab

PropagationPolicy:

ColumnDescription
NameThe PropagationPolicy name
NamespaceThe namespace the policy belongs to
ScopeNamespace-scoped policies / cluster-scoped policies
Target ClustersThe list of target clusters

OverridePolicy:

Shown where there are per-cluster custom settings.

The Labels Tab

Shows the list of Kubernetes labels applied to the CronJob.

The Annotations Tab

Shows the list of annotations applied to the CronJob.

The Pods Tab

Shows the pods of the Jobs created by that CronJob.

The Pods tab

Note: a CronJob creates a Job on schedule, and the Job creates the pods. When no Job is running now, no pods are shown.

ColumnDescription
NameThe pod name
ClusterThe cluster the pod is running on
StatusThe pod state (Running / Pending / Succeeded / Failed)
NodeThe node the pod is scheduled on
RestartsThe pod restart count
AgeThe time since the pod was created
ActionsThe view and delete buttons

The Events Tab

Shows the Kubernetes events related to the CronJob.

Creating a CronJob

Creates a new CronJob on the MCM control plane.

Fields

FieldRequiredDescription
NameThe CronJob name
NamespaceThe namespace to deploy into
Container imageThe container image URL
ScheduleThe cron expression (*/5 * * * *, for example)
Command-The container command
Concurrency Policy-Allow / Forbid / Replace (default: Allow)
Starting Deadline-How long a Job creation may be delayed, in seconds
Successful Jobs History-How many successful Jobs to keep (default: 3)
Failed Jobs History-How many failed Jobs to keep (default: 1)

Editing the YAML

The "Edit YAML" tab lets you write the CronJob definition directly.

CronJob Operations

Editing a CronJob

  1. Choose the CronJob
  2. Press the "Edit" button in the detail panel
  3. Change the CronJob definition in the YAML editor
  4. Press the "Save" button

Suspending and Resuming a CronJob

A CronJob's runs can be suspended for a while and started again.

  1. Choose the CronJob and press "Edit"
  2. Change spec.suspend in the YAML:
    • true: suspended
    • false: resumed
  3. Press the "Save" button

Deleting a CronJob

⚠️ Caution: deleting a CronJob deletes every Job and pod that belongs to it.

  1. Choose the CronJob to delete
  2. Press the "Delete" button in the detail panel
  3. Type the CronJob name in the confirmation dialog
  4. Press the "Delete" button

Worked Examples

Scenario 1: Creating a Regular Backup CronJob

  1. Press the "Create" button
  2. Enter the CronJob details:
    • Name: daily-backup
    • Namespace: production
    • Container image: my-registry/backup:v1.0
    • Schedule: 0 2 * * * (2 am every day)
    • Command: ["/backup.sh", "--full"]
  3. Press the "Create" button
  4. Name the target clusters with a PropagationPolicy
  5. Confirm the Job is created on the Events tab

Scenario 2: Checking a CronJob's Schedule

  1. Click the CronJob you want to check in the list
  2. Check the schedule on the Overview tab:
    • The schedule expression
    • The schedule description (in human-readable form)
    • When it is next due to run
  3. Check the last run in CronJob Status

Scenario 3: Checking the History of Failed Jobs

  1. Choose the CronJob and open the Overview tab
  2. Check the History Limits section:
    • Successful Jobs History: how many successful Jobs are kept
    • Failed Jobs History: how many failed Jobs are kept
  3. Check the failure events on the Events tab
  4. Check the failed pod's logs on the Pods tab

Scenario 4: Suspending a CronJob

  1. Choose the CronJob to suspend
  2. Press the "Edit" button
  3. Set spec.suspend: true in the YAML
  4. Press "Save"
  5. Confirm the status changes to "Suspended"
  6. Confirm no new Job is created

Scenario 5: Running a CronJob Across Clusters

  1. Create the CronJob and apply a PropagationPolicy
  2. Check the "Multi-Cluster Policies" tab in the detail panel
  3. Confirm the CronJob has been shared out to the target clusters
  4. Monitor the Jobs being created on schedule on each cluster
  5. Check how the pods are running per cluster on the Pods tab

CronJob against Job

TraitCronJobJob
How it runsOn a periodic scheduleOnce
TriggerAutomatically, on the cron scheduleRuns as soon as it is created
Job creationCreates a new Job each scheduleA single Job created directly
Where it is usedRegular backups, reportsMigrations, batch processing
ManagementCreates and deletes Jobs automaticallyCreated and deleted by hand

The Cron Expression

A cron expression is made up of five fields:

The five fields of a cron expression

Common examples:

ExpressionDescription
*/5 * * * *Every 5 minutes
0 * * * *On the hour, every hour
0 0 * * *Every day at midnight
0 2 * * *Every day at 2 am
0 0 * * 0Every Sunday at midnight
0 0 1 * *The 1st of every month, at midnight
0 0 1 1 *1 January every year, at midnight

The Concurrency Policy

PolicyDescription
AllowAllows a new Job even if the previous one has not finished (the default)
ForbidSkips creating a new Job while the previous one is running
ReplaceCancels the previous Job and replaces it with the new one

The Starting Deadline

  • How late a Job may start after its scheduled time
  • Past that, the Job creation is skipped
  • It affects how a backlog of Jobs is handled after cluster downtime

For example startingDeadlineSeconds: 200

  • A Job may be created only within 200 seconds of the scheduled time
  • After 200 seconds that scheduled run is skipped

History Limits

  • successfulJobsHistoryLimit: how many successful Jobs to keep (default: 3)
  • failedJobsHistoryLimit: how many failed Jobs to keep (default: 1)

Beyond these limits, the oldest Jobs are deleted automatically.


Next Steps