이 콘텐츠는 선택한 언어로 제공되지 않습니다.

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 parallelism parameter, which specifies how many successful pod completions are needed to finish a job. If not specified, this defaults to the value in the completions parameter.
  • An optional completions parameter, 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:

apiVersion: extensions/v1beta1
kind: Job
metadata:
  name: pi
spec:
  selector:         1
    matchLabels:
      app: pi
  parallelism: 1    2
  completions: 1    3
  template:         4
    metadata:
      name: pi
      labels:
        app: pi
    spec:
      containers:
      - name: pi
        image: perl
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
  1. Label selector of the pod to run. It uses the generalized label selectors.
  2. Optional value for how many pods a job should run concurrently, defaults to completions.
  3. Optional value for how many successful pod completions is needed to mark a job completed, defaults to one.
  4. 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
Note

Scaling replication controllers also uses the oc scale command with the --replicas option, but instead changes the replicas parameter of a replication controller configuration.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.