Failing a Kubernetes Deployment

3/21/2019

I wonder if there is a way to have a deployment stop recreating new pods, when those failed multiple times. In other, given that we can't for instance have a restartPolicy never in a pod template of a Deployment, i am wondering, how can i consider a service failed and have in a stopped state.

We have a use case, where imperatively need to have kubernetes interrupt a deployment that have all his pods constantly failing.

-- MaatDeamon
kubernetes

1 Answer

3/21/2019

Consider using a type "Job" instead of Deployment. According to the docs:

Use a Job for Pods that are expected to terminate, for example, batch computations. Jobs are appropriate only for Pods with restartPolicy equal to OnFailure or Never.

Hope this helps!

-- Frank Yucheng Gu
Source: StackOverflow