Is there a way to prevent readiness probe from execution once container has successfully started? I suppose that liveness probe should be enough to monitor container health.
The readiness and liveness probes serve slightly different purposes.
The readiness probe controls whether the pod IP is included in the list of endpoints for a service, and so also whether a target for a route when it is exposed via an external URL.
The liveness probe determines whether a pod is still running normally or whether it should be restarted.
Technically an application could still be running fine, but is perhaps backlogged, and so you want to use the readiness probe to temporarily remove it from the set of endpoints for a service to avoid further requests being routed its way and simply being blocked in the request queue for that specific pod when another pod could handle it.
So I personally would agree the duplication seems strange, but it is that way so the different situations can be distinguished.
This problem should be now addressed with Startup probes.
The startup probe is called during startup and is used to determine when the container is ready to accept requests. If a startup probe is configured, the liveness and readiness checks are disabled until the startup probe succeeds.
Startup probes can be set at an aggressive pace to ensure that your application is available as soon as possible.
Readiness probe can be set at a less aggressive pace to handle "backlog" like situations mentioned in the accepted answer.
And Liveness probe when you need a pod restart.
© 2022 - 2024 — McMap. All rights reserved.