DELAPARRA
Index
Color
NL
Category: Kubernetes

Job

Explained by Updated

What is Job?

Job: Runs a Pod to completion — a batch task that should run once, succeed, and stop. Kubernetes retries it until the configured number of completions succeed. A Job in Kubernetes runs a task to completion: a pod starts, does its work and stops. If it fails, Kubernetes retries it up to a set limit, the backoffLimit.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Job

How is Job used in practice?

Typical uses are database migrations, data imports, one-off fixes and batch processing. Unlike a Deployment, a Job is finished once it succeeds and is not restarted.

What should you keep in mind with Job?

Make Jobs safe to run more than once, because a retry after a timeout may repeat work that partly succeeded. Set ttlSecondsAfterFinished so finished Jobs and their pods are cleaned up automatically. For migrations, run the Job before the new application version starts serving traffic, for example as part of your deploy pipeline. For recurring tasks, use a CronJob, which creates Jobs on a schedule.

What does an example of Job look like?

apiVersion: batch/v1 kind: Job metadata: name: migrate spec: backoffLimit: 4 template: spec: restartPolicy: Never containers: - name: migrate image: myapp:1.0 command: ["./migrate.sh"]

At a glance

CategoryKubernetes
Explained by
Updated

More Kubernetes terms

All terms starting with J

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.