How to ensure that a pod does not restart?

3/14/2019

I have a pod that is meant to run a code excerpt and exit afterwards. I do not want this pod to restart after exiting, but apparently it is not possible to set a restart policy in Kubernetes (see here and here).

Therefore my question is: how can I implement a pod that runs only once?

Thank you

-- João Matos
kubernetes

1 Answer

3/14/2019

You need to deploy a job. A deployment is meant to keep the containers running all the time. Give a check on:

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

-- Leandro Donizetti Soares
Source: StackOverflow