João Matos
João Matos

Reputation: 6920

How to ensure that a pod does not restart?

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

Upvotes: 2

Views: 645

Answers (1)

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/

Upvotes: 3

Related Questions