How can I run a cronjob on multiple nodes sequentially in kubernetes?

10/21/2020

I have two different types of worker nodes, ones that do data preparation and nodes that do machine learning.
I want to run a Cronjob that runs one process on a preparation node, then (only when finished) a second process on an ML node.
How can I do this in Kubernetes?

-- GDev
kubernetes
kubernetes-cronjob
nodeselector

1 Answer

10/21/2020

I want to run a Cronjob that runs one process on a preparation node, then (only when finished) a second process on an ML node.

A CronJob is only one Pod.

What you want to do here is a Workflow or Pipeline consisting of two pods, executed on different nodes.

This can be done with e.g. Argo Workflow or Kubeflow Pipelines or maybe Tekton Pipeline.

-- Jonas
Source: StackOverflow