CronJobs
Schedule a Kubernetes Job in AWS and GCP by creating a Kubernetes CronJob in the DuploCloud Portal
A Kubernetes CronJob is a variant of a Kubernetes Job you can schedule to run at periodic intervals.
See the Kubernetes CronJob documentation for more information.
Creating a Kubernetes CronJob in the DuploCloud portal
In the DuploCloud Portal, navigate to Kubernetes -> CronJob.
Click Add. The Add Kubernetes CronJob page displays.
In the Basic Options step, specify the Kubernetes CronJob name.
In the Schedule field, specify the Cron Schedule in Cron Format. Click the Info Tip icon for examples. When specifying a Schedule in Cron Format, ensure you separate each value with a space. For example,
0 0 * * 0is a valid Cron Format input;00**0is not. See the Kubernetes documentation for detailed information about Cron Format.In the Container - 1 area, specify the Container Name and associated Docker Image.

In the Command field, specify the command attributes for Container - 1. Click the Info Tip icon for examples. Select and copy commands as needed.

To run the Kubernetes CronJob to completion, you must specify a Kubernetes Init Container. Click the Add Container
button and select the Add Init Container option. The Init Container - 1 area displays.

In the Init Container - 1 area, specify the Container Name and associated Docker Image.
Click Next to open the Advanced Configuration step.
In the Other Spec Configuration field, specify the Kubernetes CronJob spec (in YAML) for Init Container - 1. Click the Info Tip icon (
) for examples. Select and copy commands as needed


Click Create. The Kubernetes CronJob is created and displayed on the CronJob page. It will run according to the schedule you specified.

Managing Kubernetes CronJobs faults
You can manage/override Kubernetes Jobs faults on a Tenant or CronJob level. If a CronJob fails, and no Tenant- or Job-level fault setting is configured, DuploCloud will generate a fault by default.
Tenant-level Kubernetes CronJobs faults
Enable or disable faults for failed Kubernetes CronJobs in a specific Tenant.
From the DuploCloud Portal, navigate to Administrator -> Tenant.
Click the Tenant name in the NAME column.
Select the Settings tab, and click Add. The Add Tenant Feature pane displays.
From the Select Feature list box, select Enable K8s job fault logging by default, and use the toggle switch to enable or disable the setting.
Click Add. The CronJobs fault setting is added.

The Add Tenant Feature pane with Enable K8s Job fault logging by default enabled
You can view the CronJobs fault setting on the Tenants page (Navigate to Administrator -> Tenant, select the Tenant name) under the Settings tab. If the value is true, DuploCloud will generate a fault. If the value is false, DuploCloud will not generate a fault.

Jobs-level Kubernetes CronJobs faults
You can configure the faults for a specific CronJob when creating the CronJob in DuploCloud. Fault settings added this way override Tenant-level settings. On the Add Kubernetes Job page, in the Metadata Annotations field, enter:
duplocloud.net/fault/when-failed: true. or
duplocloud.net/fault/when-failed: false.
When the value is true and the CronJob fails, DuploCloud will generate a fault. When the value is false and the CronJob fails, a fault will not be generated.
Viewing Kubernetes CronJobs
Viewing CronJob Details
In the DuploCloud Portal, navigate to Kubernetes -> CronJobs.
Select the Kubernetes CronJob you want to view from the NAME colunm.
Select the Overview, Schedule, and Details tabs for information about the CronJob schedule and history.
Viewing the Latest Job from a CronJob
You can inspect the most recent CronJob execution from the link on the CronJob details page. This allows you to view the latest Job, including its logs, status, and container details, without manually browsing the Jobs list.
Navigate to Kubernetes -> CronJobs.
Select the CronJob you want to inspect from the NAME column.
Click the Latest Scheduled Job link in the heading. The Job details page displays, showing information about the most recent execution of the CronJob.


This enhancement improves traceability and simplifies debugging by reducing the steps needed to find and review recent executions.
Viewing Kubernetes CronJobs by container
You can view the Kubernetes CronJobs associated with a specific container by following these steps:
In the DuploCloud Portal, navigate to Kubernetes -> Containers.
Select the container from the NAME column. You can filter container names using the Search field at the top of the page to narrow down your selection. The linked CronJob for that container displays, showing you the details of the job using it.

Managing Kubernetes CronJobs
You can view, edit, delete, or manually run a Kubernetes CronJob from the options menu on the CronJobs page.
In the DuploCloud Portal, navigate to Kubernetes -> CronJob.
Click the menu icon (
) to the left of the Kubernetes CronJob name.

CronJob page with the menu options highlighted Choose one of the following actions:
View
View CronJob configuration and details across the Overview, Schedule, and Details tabs.
Edit
Modify fields such as Cleanup After Finished, Other Spec Configuration, Metadata Annotations, and Labels.
Run Now
Trigger the CronJob immediately, outside of its scheduled interval.
Delete
Permanently remove the CronJob.
Running CronJobs on Shared Hosts
DuploCloud supports running Kubernetes CronJobs on Shared Hosts in both AWS and Azure.
For detailed steps, see the Shared Hosts documentation for AWS and Shared Hosts documentation for Azure.
Last updated
Was this helpful?

