Jobs

Create Kubernetes Jobs in AWS and GCP from the DuploCloud Portal

In Kubernetes, a Job is a controller object that represents 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. You use a 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 such as Deployments.

Refer to the Kubernetes Job documentation for use cases and examples of when to use jobs.

Using Kubernetes Jobs for Pod management

Pods are the smallest deployable units of computing 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 application containers that are tightly coupled.

In the DuploCloud Portal, you can create K8s Jobs to create one or more Pods. The Job continues to retry execution of the Pods until a specified number of them successfully terminate. The K8s Jobs tracks the successful terminations. When the specified number of successful terminations completes, the Job is marked as completed in Kubernetes. Deleting a Job cleans up the Pods that the job created. Suspending a Job delete the Job's active Pods until the Job is resumed again.

You typically create one Job object to reliably run one Pod to completion. 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 Job to run multiple Pods in parallel. If you want to run a Job (either a single task, or several in parallel) on a schedule, see CronJobs.

Creating a Kubernetes Job in the DuploCloud portal

  1. In the DuploCloud Portal, select the Tenant you are working with from the Tenant list box at the top-left of the DuploCloud Portal.

  2. Navigate to Kubernetes -> Job.

  3. Click Add. The Add Kubernetes Job page displays.

  4. In the Basic Options step, specify the Kubernetes Job Name.

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

  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.

  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 Job spec (in YAML) for Init Container - 1. Click the Info Tip icon for examples. Select and Copy commands as needed.

  4. Click Create. The job is created and displayed on the Job page with a status of Active.

Viewing a Kubernetes Job

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

  2. Select the job you want to view and click the Overview, Containers, and Details tabs for more information about the job status and job history.

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

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

  2. Select the K8s job you want to edit.

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

  • Cleanup After Finished in Seconds

  • Other Spec Configuration

  • Metadata Annotations

  • Labels

Deleting a Kubernetes Job

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

  2. Select the K8s job you want to delete.

Last updated

Logo

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