Skip to Content
Kubernetes Cookbook - Second Edition
book

Kubernetes Cookbook - Second Edition

by Hideto Saito, Hui-Chuan Chloe Lee, Ke-Jou Carol Hsu
May 2018
Intermediate to advanced
554 pages
13h 51m
English
Packt Publishing
Content preview from Kubernetes Cookbook - Second Edition

Create a parallel Job

If your batch Job doesn't have a state or dependency between Jobs, you may consider submitting Jobs in parallel. Similar to the spec.completions parameter, the Job template has a spec.parallelism parameter to specify how many Jobs you want to run in parallel:

1. Re-use a repeatable Job but change it to specify spec.parallelism: 3 as follows:

$ cat job-dpkg-parallel.yaml apiVersion: batch/v1kind: Jobmetadata:  name: package-checkspec:  parallelism: 3  template:    spec:      containers:      - name: package-check        image: ubuntu        command: ["dpkg-query", "-l"]      restartPolicy: Never
  1. The result is similar to spec.completions=3, which made 3 Pods to run your application:
$ kubectl get pods --show-allNAME                  READY     STATUS      RESTARTS   AGEpackage-check-5jhr8 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes Cookbook

Kubernetes Cookbook

Sébastien Goasguen, Michael Hausenblas
DevOps with Kubernetes - Second Edition

DevOps with Kubernetes - Second Edition

Hideto Saito, Hui-Chuan Chloe Lee, Cheng-Yang Wu

Publisher Resources

ISBN: 9781788837606Supplemental Content