Can Traefik wait for a backend until it's ready instead of returning 500 error?


I'm using Traefik on several clusters. When I restart a pod it will not be ready and traefik will return 500 error when accessing the url for that pod (with "Service Unavailable" text).
I wonder if Traefik can queue a resquest and wait for the backend to be ready instead of returning the 500 error?

Hello @minhdanh,

You need to look into configuring liveliness and readiness probes for your pod:

Traefik will only route traffic when pods are ready.

If your service has no ready pods, then the 5XX error returned would be considered correct.

Hi @daniel.tomcej,
Thank you for your reply.
I thought of using liveness probes and readiness probes so that when doing a rolling upgrade traefik will always have a reliable backend pod to serve the requests. But in some cases like when using a pod with a PVC, having multiple replicas of such pod is not available thus when that pod is restarted it'll cause a small downtime.
I checked traefik docs and saw this related link:
So basically in Traefik v2 I can use this middleware to retry until a backend pod responses after it's restarted, right?