Refer to the official Kubernetes documentation:
CronJob define tasks that run to completion and then stop. They allow you to run the same Job multiple times according to a schedule.
A CronJob is a type of workload controller in Kubernetes. You can create a CronJob through the web console or CLI to periodically or repeatedly run a non-persistent program, such as scheduled backups, scheduled clean-ups, or scheduled email dispatches.
kubectl
configured and connected to your cluster.Obtain the image address. Images can be sourced from an image registry integrated by the platform administrator via a toolchain, or from third-party image registries.
For images from an integrated registry, the Administrator typically assigns the image registry to your project, allowing you to use the images within it. If the required image registry is not found, please contact the Administrator for allocation.
If using a third-party image registry, ensure that images can be pulled directly from it within the current cluster.
Container Platform, navigate to Workloads > CronJobs in the left sidebar.
Click on Create CronJob.
Select or Input an image, and click Confirm.
Note: Image filtering is available only when using images from the platform's integrated image registry. For example, an integrated project name like containers (docker-registry-projectname) indicates the platform's project name projectname and the image registry's project name containers.
In the Cron Configuration section, configure the task execution method and associated parameters.
Execute Type:
Manual: Manual execution requires explicit manual triggering for each task run.
Scheduled: Scheduled execution requires configuring the following scheduling parameters:
Parameter | Description |
---|---|
Schedule | Define the cron schedule using Crontab syntax. The CronJob controller calculates the next execution time based on the selected timezone. Notes:
|
Concurrency Policy | Specify how concurrent Job executions are handled (Allow , Forbid , or Replace per K8s spec). |
Job History Retention:
In the Job Configuration section, select the job type. A CronJob manages Jobs composed of Pods. Configure the Job template based on your workload type:
Parameter | Description |
---|---|
Job Type | Select Job completion mode (Non-parallel , Parallel with fixed completion count , or Indexed Job per K8s Job patterns). |
Backoff Limit | Set the maximum number of retry attempts before marking a Job as failed. |
Status | Description |
---|---|
Pending | The Job has been created but not yet scheduled. |
Running | The Job Pod(s) are actively executing. |
Succeeded | All Pods associated with the Job completed successfully (exit code 0). |
Failed | At least one Pod associated with the Job terminated unsuccessfully (non-zero exit code). |