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

  1. In the DuploCloud Portal, navigate to Kubernetes -> CronJob.

  2. Click Add. The Add Kubernetes CronJob page displays.

  3. In the Basic Options step, specify the Kubernetes CronJob name.

  4. 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 * * 0 is a valid Cron Format input; 00**0 is not. See the Kubernetes documentation for detailed information about Cron Format.

  5. In the Container - 1 area, specify the Container Name and associated Docker Image.

The Add Kubernetes CronJob page with Container Name and Docker image fields filled.
  1. In the Command field, specify the command attributes for Container - 1. Click the Info Tip icon for examples. Select and copy commands as needed.

The Add Kubernetes CronJob page with the Command options window open.
The Add Kubernetes CronJob page with the Command field for Container - 1 filled.
  1. 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.

Add Init Container area.
  1. In the Init Container - 1 area, specify the Container Name and associated Docker Image.

  2. Click Next to open the Advanced Configuration step.

  3. 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

The Other Spec Configuration window on the Add Kubernetes CronJob, Advanced Configuration page.
The Add Kubernetes CronJob page with the Other Spec Configuration field completed.
  1. Click Create. The Kubernetes CronJob is created and displayed on the CronJob page. It will run according to the schedule you specified.

K8s CronJob tab displaying Kubernetes Job CALCULATEPI.

Viewing a Kubernetes CronJob

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.

  1. From the DuploCloud Portal, navigate to Administrator -> Tenant.

  2. Click the Tenant name in the NAME column.

  3. Select the Settings tab, and click Add. The Add Tenant Feature pane displays.

  4. 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.

  5. 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.

The Tenant details page, Settings tab, showing the configured Jobs fault setting

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 a Kubernetes CronJob

  1. In the DuploCloud Portal, navigate to Kubernetes -> CronJobs.

  2. Select the Kubernetes CronJob you want to view and click the Overview, Schedule, and Details tabs for more information about the CronJob schedule and history.

You can also view details of a Kubernetes CronJob by clicking on the menu icon ( ) icon to the left of the job name and selecting View.

Overview tab for Kubernetes Job MYCRONJOB.
CronJob options menu with View option highlighted.

Using the Container page to view linked Kubernetes CronJobs

You can view Kubernetes CronJobs linked to containers by clicking the container name on the Containers page (Kubernetes -> Containers).

Clicking the Container Name on the Containers page to view a linked K8s CronJob

You can filter container names by using the search field at the top of the page, as in this example:

Highlighted search field on the Containers page

Editing a Kubernetes CronJob

  1. In the DuploCloud Portal, navigate to Kubernetes -> CronJob.

  2. Select the Kubernetes CronJob you want to edit.

  3. Click the options menu ( ) icon to the left of the Kubernetes CronJob name and select Edit.

You can edit and modify the following fields in the DuploCloud Portal:

  • Cleanup After Finished in Seconds

  • Other Spec Configuration

  • Metadata Annotations

  • Labels

CronJob options menu with Edit option highlighted

Deleting a Kubernetes CronJob

  1. In the DuploCloud Portal, navigate to Kubernetes -> CronJob.

  2. Select the Kubernetes CronJob you want to delete.

  3. Click the Options Menu () icon to the left of the Kubernetes CronJob name and select Delete.

CronJob options menu with Delete option highlighted

Last updated

Logo

© DuploCloud, Inc. All rights reserved. DuploCloud trademarks used herein are registered trademarks of DuploCloud and affiliates