Search code examples
kuberneteskubernetes-statefulsetstatefulsetlivenessprobe

Kubernetes StatefulSets and livenessProbes


Liveness probes are supposed to trigger a restart of failed containers. Do they respect the default stateful set deployment and scaling guarantees. E.g. if the liveness probe fails at the same time for multiple pods within one and the same stateful set, would K8S attempt to restart one container at a time or all in parallel?


Solution

  • According to https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ the liveness probes are a feature implemented in the kubelet:

    The kubelet uses liveness probes to know when to restart a container.

    This means any decision about scheduling that requires knowledge of multiple pods is not taken into account.

    Therefore if all your statefulset's pods have failing liveness probes at the same time they will be rescheduled at about the same time not respecting any deployment-level guarantees.