Jobs
Create Kubernetes Jobs in AWS and GCP from the DuploCloud Portal
Last updated
Create Kubernetes Jobs in AWS and GCP from the DuploCloud Portal
Last updated
© DuploCloud, Inc. All rights reserved. DuploCloud trademarks used herein are registered trademarks of DuploCloud and affiliates
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.
Pods are the smallest deployable computing units that you can create and manage in Kubernetes. A Pod is a group of one or more containers with shared storage and network resources, including a specification that dictates how to run the containers. A Pod's contents are always co-located and co-scheduled and run in a shared context. A Pod models an application-specific "logical host": it contains one or more tightly coupled application containers.
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. 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 again.
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.
In the DuploCloud Portal, select the Tenant from the Tenant list box at the top-left of the DuploCloud Portal.
Navigate to Kubernetes -> Job.
Click Add. The Add Kubernetes Job page displays.
In the Basic Options step, specify the Kubernetes Job name.
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.
In the Command field, specify the command attributes for Container - 1. Click the Info Tip icon for examples. Select and Copy commands as needed.
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 Job spec (in YAML) for Init Container - 1. Click the Info Tip icon for examples. Select and copy commands as needed.
Click Create. The Kubernetes Job is created and displayed on the Job page with a status of Active.
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 Job spec (in YAML) for Init Container - 1. Click the Info Tip icon for examples. Select and Copy commands as needed.
Click Create. The job is created and displayed on the Job page with a status of Active.
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:
labels
are key-value pairs used to organize, categorize, and identify resources such as Pods, Nodes, Jobs, and more. Thecompliance: HIPAA
label applied in the example indicates that the Kubernetes Job is associated with a HIPAA compliance context.
nodeSelector
specifies that the Kubernetes Job should be scheduled on specific nodes. In this example, it will be scheduled on nodes with the label security-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.
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.
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.
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.
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.
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 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:
In the DuploCloud Portal, navigate to Kubernetes -> Job.
Select the K8s Job you want to edit.
You can edit and modify the following fields in the DuploCloud portal:
Cleanup After Finished in Seconds
Other Spec Configuration
Metadata Annotations
Labels
In the DuploCloud Portal, navigate to Kubernetes -> Job.
Select the K8s Job you want to delete.
To run the Kubernetes Job 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.
To run the Kubernetes Job 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.
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.
Click the options menu ( ) icon to the left of the K8s Job you want to edit and select Edit.
Click the Job options menu ( ) icon to the left of the Job name and select Delete.