K8s: StatefulSet how to increase time between resatrt of pod in case fails

5/21/2019

I have integration test, where i start StatefulSet, wait untill ready and then do some asserts.

My problem that if Application fails - it try to restart too fast. And I can't get logs from failed pod.

SO my question how can i increase time between Restart of pod in StatefulSet? Because K8s controllers do not support RestartPolicy: Never.

-- Grigoriev Nick
application-restart
kubernetes
statefulset

2 Answers

5/21/2019

I would try to run the service in question as a regular deployment and convert it to a StatefulSet after I analyze the issue with the application.

Why can't you get the logs from the terminated pods?

Maybe you should try to set terminationGracePeriodSeconds on the SS container to make the dying pods stay longer for analysis.

-- antweiss
Source: StackOverflow

5/21/2019

If all you want is to view the logs of the terminated pod, you can do

kubectl log <pod_name> --previous

-- redgetan
Source: StackOverflow