How to run a Kubernetes job exactly once

4/7/2017

I have a job with restartPolicy: Never and completions and parallelism = 1. However the spec says: 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 somebody explain why this? And maybe offer a solution that the K8s guys did not think about? :D

-- lcfd
kubernetes

1 Answer

4/12/2017

I think the reason why

the same program may sometimes be started twice.

is because of the provided consistency guarantees. In distributed environments, guaranteeing various levels of strictness often comes with a performance trade-off. I might be wrong, but that’s my guess.

-- AhmetB - Google
Source: StackOverflow