2
votes

In the kubernetes documentation there is the following note at the page https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/

Note that even if you specify .spec.parallelism = 1 and .spec.completions = 1 and .spec.template.spec.restartPolicy = "Never", the same program may sometimes be started twice.

Can this be avoided? E.g.: can we make sure that a job is started only at-most-once?

Thanks.

1

1 Answers

0
votes

No, the kubernetes job controller machinery does not support at-most-once or exactly-once semantics. There are various race and failure conditions that at-most-once and exactly-once would have to protect against. All the kube controllers do is periodically reconcile what they detect about the state of the cluster against spec.