Jobs
Create Kubernetes Jobs in AWS and GCP from the DuploCloud Portal
In Kubernetes, a Job is a controller object representing a task or a set of tasks that runs until successful completion. It is designed to manage short-lived batch workloads in a Kubernetes cluster. Use a Kubernetes Job when you need to run a task or a set of tasks once, to completion, rather than continuously, as in other types of controllers like Deployments.
Refer to the Kubernetes Job documentation for use cases and examples of when to use Kubernetes Jobs.
Using Kubernetes Jobs for Pod management
In the DuploCloud Portal, you can create K8s Jobs to create one or more Pods. The Job retries until a specified number of Pods are successfully executed. Kubernetes Jobs tracks successful terminations, and when the specified number of successful terminations are completed, the Job is marked as completed in Kubernetes. Deleting a Kubernetes Job cleans up the Pods that it created. Suspending a Kubernetes Job deletes its active Pods until it is resumed.
You typically create one Kubernetes Job object to run one Pod to completion reliably. The Job object starts a new Pod if the first Pod fails or is deleted (for example, in case of a node hardware failure or a node reboot).
You can also use a Kubernetes Job to run multiple Pods in parallel. If you want to run a Kubernetes Job (a single task or several in parallel) on a schedule, see Kubernetes CronJobs.
Creating a Kubernetes Job
Navigate to Kubernetes -> Job.
Click Add. The Add Kubernetes Job page displays.

Add Kubernetes Job - Basic Options page Complete the fields as follows:
Name
Enter a name for the Job, e.g., job1. Required.
Cleanup After Finished in Seconds (TTL)
Enter a TTL value in seconds, e.g., 86400.
Restart Policy
Select the restart policy, e.g., Never.
Backoff Limit
Enter the maximum number of retries before the Job is marked failed.
Allocation Tag
Enter Allocation Tags if needed for resource allocation.
Enter the details for Container 1 as needed (Container Name, Docker Image, Command, Environment Variables, Arguments, Other Container Config).
If your Job requires Init Containers, click the caret next to Add Container and select Add Init Container.
To add more containers, click Add Container as many times as needed and fill in their details.
Container Name
Enter the container name, e.g., main. Required.
Docker Image
Enter the Docker image to run, e.g., nginx:latest. Required.
Command
Enter any commands to run in the container.
Environment Variables
Enter environment variables to set in the container.
Arguments
Enter arguments for the container.
Other Container Config
Enter any additional container configuration.
Click Next. The Advanced Options pane displays.

Complete the additional fields as needed:
Other Spec Configuration
Enter any additional container or pod specifications needed.
Metadata Annotations
Enter annotations in key=value format to add custom metadata to the Job or pods.
Metadata Labels
Enter labels in key=value format. To specify an App Name, use: app.duplocloud.net/app-name: "<your-app-name>"
Click Create. The job is created and displayed on the Job page with a status of Active.

Using Allocation Tags with Kubernetes Jobs
Allocation tags for Kubernetes Jobs (labels, node selectors, or node affinity) help manage resources in a Kubernetes environment. They can be useful for:
Resource Organization
Scheduling and Affinity Rules
Resource Quotas and Limits
Monitoring and Logging
Cost Allocation and Billing
You can add allocation tags in the Allocation Tag field when creating Kubernetes Jobs.
In the YAML below, the following act as allocation tags:
labelsare key-value pairs used to organize, categorize, and identify resources such as Pods, Nodes, Jobs, and more. Thecompliance: HIPAAlabel applied in the example indicates that the Kubernetes Job is associated with a HIPAA compliance context.nodeSelectorspecifies that the Kubernetes Job should be scheduled on specific nodes. In this example, it will be scheduled on nodes with the labelsecurity-level: high.
To learn more about allocation tags for Kubernetes Jobs, see the Kubernetes documentation on labels and selectors and node selectors and node affinity.
Managing Kubernetes Jobs faults
You can manage/override Kubernetes Jobs faults on a Tenant or Job level. If a Job fails, and no Tenant- or Job-level fault setting is configured, DuploCloud will generate a fault by default.
Tenant-level Kubernetes Jobs faults
Enable or disable faults for failed Kubernetes Jobs 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 Jobs fault setting is added.

The Add Tenant Feature pane with Enable K8s Job fault logging by default enabled
You can view the Jobs 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 Jobs faults
You can configure the faults for a specific Job when creating the Job 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 Job fails, DuploCloud will generate a fault. When the value is false and the Job fails, a fault will not be generated.
Viewing a Kubernetes Job
In the DuploCloud Portal, navigate to Kubernetes -> Job.
Select the Kubernetes Job you want to view and click the Overview, Containers, and Details tabs for more information about the Job status and history.
You can also view a Kubernetes Job's details by clicking the menu icon (
) icon to the left of the Job name and selecting View.


Using the Containers page to view linked Kubernetes Jobs
You can view K8s Jobs linked to Containers by clicking the Container Name on the Containers page (Kubernetes -> Containers).

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

Editing a Kubernetes Job
In the DuploCloud Portal, navigate to Kubernetes -> Job.
Select the K8s Job you want to edit.
Click the options menu (
) icon to the left of the K8s Job you want to edit 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

Deleting a Kubernetes Job
In the DuploCloud Portal, navigate to Kubernetes -> Job.
Select the K8s Job you want to delete.
Click the Job options menu (
) icon to the left of the Job name and select Delete.

Running Jobs on Shared Hosts
DuploCloud supports running Kubernetes Jobs 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?

