Getting the Jobs Done With
Kubernetes / OpenShift
Maciej Szulik, KubeCon 2016
1 / 20
soltysh @    
maszulik@redhat.com
https://github.com/soltysh/talks/
2 / 20
3 / 20
Job
4 / 20
Job apiVersion: batch/v1
kind: Job
metadata:
name: hello
spec:
template:
metadata:
name: hello
spec:
containers:
- name: hello
image: python:3.5.1
command: ["python", "-c",
"print('Hello world!')"]
restartPolicy: Never
5 / 20
Job
- api
->apiVersion:batch/v1
kind: Job
metadata:
name: job
spec:
template:
metadata:
name: job
spec:
containers:
- name: job
image: python:3.5.1
command: ["python", "-c",
"print('Hello world!')"]
restartPolicy: Never
6 / 20
Job
- api
- command
apiVersion: batch/v1
kind: Job
metadata:
name: job
spec:
template:
metadata:
name: job
spec:
containers:
-> -name:job
image:python:3.5.1
command:["python","-c",
"print('Helloworld!')"]
restartPolicy: Never
7 / 20
Job
- api
- command
- restart policy
apiVersion: batch/v1
kind: Job
metadata:
name: job
spec:
template:
metadata:
name: job
spec:
containers:
- name: job
image: python:3.5.1
command: ["python", "-c",
"print('Hello world!')"]
-> restartPolicy:Never
8 / 20
Job
- api
- command
- restart policy
Always
OnFailure
Never
9 / 20
Job
- api
- command
- restart policy
Always
OnFailure
Never
10 / 20
Job
- api
- command
- restart policy
- pod selector?
apiVersion: batch/v1
kind: Job
metadata:
name: job
spec:
template:
metadata:
name: job
spec:
containers:
- name: job
image: python:3.5.1
command: ["python", "-c",
"print('Hello world!')"]
restartPolicy: Never
11 / 20
Job
- api
- command
- restart policy
- pod selector?
- parallelism /
completions
single jobs
.spec.completions: 1
.spec.parallelism: 1
12 / 20
Job
- api
- command
- restart policy
- pod selector?
- parallelism /
completions
single jobs
.spec.completions: 1
.spec.parallelism: 1
parallel job with a fixed completions count
.spec.completions: 8
.spec.parallelism: 4
13 / 20
Job
- api
- command
- restart policy
- pod selector?
- parallelism /
completions
single jobs
.spec.completions: 1
.spec.parallelism: 1
parallel job with a fixed completions count
.spec.completions: 8
.spec.parallelism: 4
parallel job with a work queue
.spec.completions: <unset>
.spec.parallelism: 4
14 / 20
Use Cases
- data calculations
- image rendering
etc.
15 / 20
Rendering
16 / 20
Render demo
17 / 20
Future
workflow by @sdminonne
indexed jobs by @erictune
scheduled jobs by @soltysh
18 / 20
http://commons.openshift.org/join
19 / 20
Links
soltysh @    
maszulik@redhat.com
http://releases.k8s.io/master/docs/proposals/job.md
http://releases.k8s.io/master/docs/user-guide/jobs.md
20 / 20

KubeCon EU 2016: Getting the Jobs Done With Kubernetes

  • 1.
    Getting the JobsDone With Kubernetes / OpenShift Maciej Szulik, KubeCon 2016 1 / 20
  • 2.
    soltysh @    maszulik@redhat.com https://github.com/soltysh/talks/ 2 / 20
  • 3.
  • 4.
  • 5.
    Job apiVersion: batch/v1 kind:Job metadata: name: hello spec: template: metadata: name: hello spec: containers: - name: hello image: python:3.5.1 command: ["python", "-c", "print('Hello world!')"] restartPolicy: Never 5 / 20
  • 6.
    Job - api ->apiVersion:batch/v1 kind: Job metadata: name:job spec: template: metadata: name: job spec: containers: - name: job image: python:3.5.1 command: ["python", "-c", "print('Hello world!')"] restartPolicy: Never 6 / 20
  • 7.
    Job - api - command apiVersion:batch/v1 kind: Job metadata: name: job spec: template: metadata: name: job spec: containers: -> -name:job image:python:3.5.1 command:["python","-c", "print('Helloworld!')"] restartPolicy: Never 7 / 20
  • 8.
    Job - api - command -restart policy apiVersion: batch/v1 kind: Job metadata: name: job spec: template: metadata: name: job spec: containers: - name: job image: python:3.5.1 command: ["python", "-c", "print('Hello world!')"] -> restartPolicy:Never 8 / 20
  • 9.
    Job - api - command -restart policy Always OnFailure Never 9 / 20
  • 10.
    Job - api - command -restart policy Always OnFailure Never 10 / 20
  • 11.
    Job - api - command -restart policy - pod selector? apiVersion: batch/v1 kind: Job metadata: name: job spec: template: metadata: name: job spec: containers: - name: job image: python:3.5.1 command: ["python", "-c", "print('Hello world!')"] restartPolicy: Never 11 / 20
  • 12.
    Job - api - command -restart policy - pod selector? - parallelism / completions single jobs .spec.completions: 1 .spec.parallelism: 1 12 / 20
  • 13.
    Job - api - command -restart policy - pod selector? - parallelism / completions single jobs .spec.completions: 1 .spec.parallelism: 1 parallel job with a fixed completions count .spec.completions: 8 .spec.parallelism: 4 13 / 20
  • 14.
    Job - api - command -restart policy - pod selector? - parallelism / completions single jobs .spec.completions: 1 .spec.parallelism: 1 parallel job with a fixed completions count .spec.completions: 8 .spec.parallelism: 4 parallel job with a work queue .spec.completions: <unset> .spec.parallelism: 4 14 / 20
  • 15.
    Use Cases - datacalculations - image rendering etc. 15 / 20
  • 16.
  • 17.
  • 18.
    Future workflow by @sdminonne indexedjobs by @erictune scheduled jobs by @soltysh 18 / 20
  • 19.
  • 20.
    Links soltysh @    maszulik@redhat.com http://releases.k8s.io/master/docs/proposals/job.md http://releases.k8s.io/master/docs/user-guide/jobs.md 20 / 20