Kubernetes can analytical jobs be chained together in a workflow?
Asked Answered
S

4

12

Reading the Kubernetes "Run to Completion" documentation, it says that jobs can be run in parallel, but is it possible to chain together a series of jobs that should be run in sequential order (parallel and/or non-parallel).

https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/


Or is it up to the user to keep track of which jobs have finished and triggering the next job using a PubSub messaging service?

Should answered 13/9, 2018 at 20:59 Comment(1)
Check out Argo.Buccal
W
3

Overall, no. Check out things like Airflow for this. Job objects give you a pretty simple way to run a container until it completes, that's about it. The parallelism is in that you can run multiple copies, it's not a full workflow management system :)

Whitefaced answered 14/9, 2018 at 0:33 Comment(0)
O
7

I have used initContainers under the PodSpec in the past to solve problems like this: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/

apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
  labels:
    app: myapp
spec:
  containers:
  - name: myapp-container
    image: busybox
    command: ['sh', '-c', 'echo The app is running! && sleep 3600']
  initContainers:
  - name: init-myservice
    image: busybox
    command: ['sh', '-c', 'until nslookup myservice; do echo waiting for myservice; sleep 2; done;']
  - name: init-mydb
    image: busybox
    command: ['sh', '-c', 'until nslookup mydb; do echo waiting for mydb; sleep 2; done;']

Take a look here for the chaining of containers using the "depends" keyword is also an option:

https://github.com/kubernetes/kubernetes/issues/1996

Orthoepy answered 13/9, 2018 at 21:27 Comment(0)
R
4

It is not possible to manage job workflows with Kubernetes core API objects.

Other alternatives include:

This document might also help: https://www.preprints.org/manuscript/202001.0378/v1/download

Rooseveltroost answered 21/12, 2020 at 8:17 Comment(1)
Turns out that kubeflow pipelines use argo. Stay woke.Should
W
3

Overall, no. Check out things like Airflow for this. Job objects give you a pretty simple way to run a container until it completes, that's about it. The parallelism is in that you can run multiple copies, it's not a full workflow management system :)

Whitefaced answered 14/9, 2018 at 0:33 Comment(0)
S
2

Nearly 3 years later, I'll throw another answer into the mix.

Kubeflow Pipelines https://www.kubeflow.org/docs/components/pipelines/overview/pipelines-overview/

Which actually use Argo under the hood.

Should answered 10/6, 2021 at 21:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.