This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.此内容没有您所选择的语言版本。
Chapter 29. Jobs
29.1. Overview 复制链接链接已复制到粘贴板!
A job, in contrast to a replication controller, runs any number of pods to completion. 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 pods it created. Jobs are part of the extensions Kubernetes API, which can be managed with oc commands like other object types.
See the Kubernetes documentation for more information about jobs.
29.2. Creating a Job 复制链接链接已复制到粘贴板!
A job configuration consists of the following key parts:
- A pod template, which describes the application the pod will create.
-
An optional
parallelismparameter, which specifies how many successful pod completions are needed to finish a job. If not specified, this defaults to the value in thecompletionsparameter. -
An optional
completionsparameter, specifying how many concurrently running pods should execute a job. If not specified, this value defaults to one.
The following is an example of a job resource:
- Label selector of the pod to run. It uses the generalized label selectors.
-
Optional value for how many pods a job should run concurrently, defaults to
completions. - Optional value for how many successful pod completions is needed to mark a job completed, defaults to one.
- Template for the pod the controller creates.
29.3. Scaling a Job 复制链接链接已复制到粘贴板!
A job can be scaled up or down by changing the parallelism parameter accordingly. You can also use the oc scale command with the --replicas option, which, in the case of jobs, modifies the parallelism parameter.
The following command uses the example job above, and sets the parallelism parameter to three:
oc scale job pi --replicas=3
$ oc scale job pi --replicas=3
Scaling replication controllers also uses the oc scale command with the --replicas option, but instead changes the replicas parameter of a replication controller configuration.