Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Data Science by (17.6k points)

eading 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?

1 Answer

0 votes
by (41.4k points)
edited by

You can use  initContainers under the PodSpec to solve this kind of problems: 

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;']

If you want to learn Kubernetes then watch this video tutorial:

If you wish to learn about Data Science visit this Data Science Online Courses.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...