Links

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. 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. 2.
    Navigate to Kubernetes -> Job.
  3. 3.
    Click Add. The Add Kubernetes Job page displays.
  4. 4.
    In the Basic Options step, specify the Kubernetes Job Name.
  5. 5.
    In the Container - 1 area, specify the Container Name and associated Docker Image.
    Add Kubernetes Job page.
  6. 6.
    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 Job page with the Command info window.
    Completed Command field for Container - 1.
  7. 7.
    To run the 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.
  8. 8.
    In the Init Container - 1 area, specify the Container Name and associated Docker Image.
    Add Init Container option on Add Container button in Container - 1 area.
  9. 9.
    Click Next to open the Advanced Configuration step.
  10. 10.
    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.
    Info Tip examples for Other Spec Configuration field in Advanced Configuration step for Init Container - 1.
    Completed Other Spec Configuration field for Init Container - 1.
  11. 11.
    Click Create. The job is created and displayed on the Job page with a status of Active.
    K8S Job tab displaying Kubernetes job MY-K8S-INVOICE-JOB with Active Status.

Viewing a Kubernetes Job

  1. 1.
    In the DuploCloud Portal, navigate to Kubernetes -> Job.
  2. 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.
You can also view details of a job by clicking the menu icon (
) icon to the left of the job name and selecting View.
Overview and Details tabs for Kubernetes job MY-K8S-INVOICE-JOB.
Job option menu with View option highlighted.

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).
Clicking the Container Name on the Containers page to view a linked K8s job
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 Job

  1. 1.
    In the DuploCloud Portal, navigate to Kubernetes -> Job.
  2. 2.
    Select the K8s job you want to edit.
  3. 3.
    Click the options menu (
    ) icon to the left of the job you want to edit and select 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
Job page options menu with Edit option highlighted.

Deleting a Kubernetes Job

  1. 1.
    In the DuploCloud Portal, navigate to Kubernetes -> Job.
  2. 2.
    Select the K8s job you want to delete.
  3. 3.
    Click the job options menu (
    ) icon to the left of the job name and select Delete.
Job options menu with Delete option highlighted