Kubernetes shcedule restart pods

5/14/2020

I have Deployment that runs 5 pods.

I want to restart all pods each 5min.

Currently I'm doing it with python scritpt that is running kubectl get po and checks AGE, if the AGE bigger than 5 min it deletes the pod.

Is there another way to achieve that?

-- samisaviv
kubernetes

1 Answer

5/14/2020

You could do a liveness check to achieve this, but why would you do it? Deployment is for LongRunning Tasks.

A liveness check will reschedule a pod if its not true (gives a other exit code than 0)

For more Info here:

https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/

-- Theroth
Source: StackOverflow