I understand what a readinessProbe does, but I don't see why it should have a periodSeconds. Once it's determined that the pod is ready, it should stop checking. Wouldn't checking periodically then be up to the livenessProbe? Or am I missing something?
-
1This is what I think it means: the readinessProbe manages whether the pod is able to receive requests. If the periodic check ever fails, then that pod is removed from the list of routable pods exposed by a service, but the pod is not restarted. The livenessProbe checks if the pod is 'dead' and will restart it. So, only if you have a service that routes to your pod does the periodic readiness check mean anything. – sffortytwo Dec 06 '22 at 10:52
2 Answers
ReadinesProbe and livenessProbe serve for different purposes.
ReadinessProbe checks if a service is ready to serve requests. If the readinessProbe fails, the container will be taken out of service for as long as the probe fails. If the readinessProbe reports up again, the container will be taken back into service again and receive requests.
In contrast, if the livenessProbe fails, it will be considered as not recoverable and the container will be terminated and restarted.
For both, periodSeconds makes sense. Even for the livenessProbe, when failure is considered only after X consecutive failed checks.

- 798
- 3
- 7
Readiness probes determine whether or not a container is ready to serve requests. If the readiness probe returns a failed state, then Kubernetes removes the IP address for the container from the endpoints of all Services.
We use readiness probes to instruct Kubernetes that a running container should not receive any traffic. This is useful when waiting for an application to perform time-consuming initial tasks, such as establishing network connections, loading files, and warming caches.
The readiness probe is configured in the spec.containers.readinessprobe
attribute of the pod configuration.
This periodSeconds field specifies that the kubelet should perform a readiness probe for every “x” seconds that is mentioned in the yaml. This Specifies the frequency of the checks to the readiness probe to check. Default to 10 seconds. Minimum value is 1.

- 2,728
- 1
- 4
- 19
-
You can also have a look into this [doc](https://cloud.redhat.com/blog/liveness-and-readiness-probes) – Hemanth Kumar Dec 07 '22 at 09:49
-
I'm sorry, but this totally misses the point of my question. You're telling me what livenessProbe is for when I was asking about readinessProbe's periodSeconds attribute. – sffortytwo Dec 07 '22 at 11:52