mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
62 lines
1.8 KiB
Plaintext
62 lines
1.8 KiB
Plaintext
:_mod-docs-content-type: ASSEMBLY
|
|
[id="nodes-nodes-jobs"]
|
|
= Running tasks in pods using jobs
|
|
include::_attributes/common-attributes.adoc[]
|
|
:context: nodes-nodes-jobs
|
|
|
|
toc::[]
|
|
|
|
|
|
A _job_ executes a task in your {product-title} cluster.
|
|
|
|
A job tracks the overall progress of a task and updates its status with information
|
|
about active, succeeded, and failed pods. Deleting a job will clean up any pod
|
|
replicas it created. Jobs are part of the Kubernetes API, which can be managed
|
|
with `oc` commands like other object types.
|
|
|
|
.Sample Job specification
|
|
|
|
[source,yaml]
|
|
----
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: pi
|
|
spec:
|
|
parallelism: 1 <1>
|
|
completions: 1 <2>
|
|
activeDeadlineSeconds: 1800 <3>
|
|
backoffLimit: 6 <4>
|
|
template: <5>
|
|
metadata:
|
|
name: pi
|
|
spec:
|
|
containers:
|
|
- name: pi
|
|
image: perl
|
|
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
|
restartPolicy: OnFailure <6>
|
|
#...
|
|
----
|
|
<1> The pod replicas a job should run in parallel.
|
|
<2> Successful pod completions are needed to mark a job completed.
|
|
<3> The maximum duration the job can run.
|
|
<4> The number of retries for a job.
|
|
<5> The template for the pod the controller creates.
|
|
<6> The restart policy of the pod.
|
|
|
|
.Additional resources
|
|
|
|
* link:https://kubernetes.io/docs/concepts/workloads/controllers/job/[Jobs (Kubernetes documentation)]
|
|
|
|
// The following include statements pull in the module files that comprise
|
|
// the assembly. Include any combination of concept, procedure, or reference
|
|
// modules required to cover the user story. You can also include other
|
|
// assemblies.
|
|
|
|
include::modules/nodes-nodes-jobs-about.adoc[leveloffset=+1]
|
|
|
|
include::modules/nodes-nodes-jobs-creating.adoc[leveloffset=+1]
|
|
|
|
include::modules/nodes-nodes-jobs-creating-cron.adoc[leveloffset=+1]
|