Make sure you specify a reasonable timeoutSeconds on your Liveness and Readiness Probes

Paul Dally
2 min readAug 11, 2023
Photo by Veri Ivanova on Unsplash

None of the examples in the Kubernetes documentation for liveness and readiness probes specify a timeoutSeconds field.

It’s NOT that the documentation doesn’t address this attribute — it definitely does. But you have to readyou can’t just cut-and-paste!

Why should you bother understanding timeoutSeconds? Well, you may find that if you don’t specify this field, your container will start unexpectedly restarting itself or your application may mysteriously becomes unavailable from time to time.

The purpose of timeoutSeconds is probably pretty self-explanatory:

  • timeoutSeconds: Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1.

Did you notice the 1 second default? That’s a pretty short timeframe — and depending on what your probe does, you may find that your Pod is healthy and yet the probe still takes longer than 1 second. But any probe that takes longer than timeoutSeconds is considered a failure… and if your probe fails more than the value you’ve provided for failureThreshold, Kubernetes will restart the container (for a livenessProbe) or stop sending any requests to the Pod (for a readinessProbe).

So — think about what an appropriate timeoutSeconds value would be for your application — and make sure you specify the field in all of your liveness and readiness probes.

--

--

Paul Dally

AVP, IT Foundation Platforms Architecture at Sun Life Financial. Views & opinions expressed are my own, not necessarily those of Sun Life