0

Is it best practice to set the liveness probes initialDelaySeconds_livenessProbe >= initialDelaySeconds_readinessProbe + periodSeconds_readinessProbe * timeoutSeconds_readinessProbe?

Take for example the following

         readinessProbe:
            initialDelaySeconds: 360
            periodSeconds: 30
            timeoutSeconds: 30
          livenessProbe:
            initialDelaySeconds: 660
            periodSeconds: 60
            timeoutSeconds: 30
            failureThreshold: 1
          startupProbe:
            initialDelaySeconds: 60
            failureThreshold: 30
            periodSeconds: 10

Over 64 starts of the application in pods the initialization of the application was maximal 120s with 99 percentile at 115s. Two thirds of applications were initialized in 60s.

So, the startup probe is done after 3 times the maximal measured initialization time of the application - 360s. Readiness and liveness probes both start after 360s. The liveness probe starts after 10 minutes.

Stefan Bollmann
  • 640
  • 4
  • 12
  • 32
  • The problem with liveness probes comes from the container startup-latency changing over time. This can be a result of network topology changes, changes in resource allocation, or just increasing load as your service scales. If a container is restarted—due to a Kubernetes-node failure, or a liveness-probe failure—and the initialDelaySeconds parameter is not long enough, you risk never starting the application, with it being killed and restarted, repeatedly, before completely starting. – Veera Nagireddy May 25 '23 at 12:26
  • 1
    The initialDelaySeconds parameter should be longer than maximum initialization time for the container. Refer to [Doc](https://blog.colinbreck.com/kubernetes-liveness-and-readiness-probes-how-to-avoid-shooting-yourself-in-the-foot/) for more info. – Veera Nagireddy May 25 '23 at 12:27
  • So, if I do not know of a container yet, that needed longer than 120s to start, this is regarding your comments, @VeeraNagireddy, an example for a good configuration? – Stefan Bollmann May 25 '23 at 12:28
  • 1
    Refer to this [doc](https://www.vultr.com/docs/how-to-configure-kubernetes-readiness-and-liveness-probes/) and please elaborate your question a bit more clear. – Veera Nagireddy May 25 '23 at 13:17

0 Answers0