samisaviv
samisaviv

Reputation: 323

Kubernetes shcedule restart pods

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?

Upvotes: 0

Views: 141

Answers (1)

Theroth
Theroth

Reputation: 31

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/

Upvotes: 1

Related Questions