Hold connection if no endpoints found?

Hey folks!

I'm running a K3s cluster with Traefik ingress controller (traefik-crd-25.0.2+up25.0.0). I have a stateful application that can only run once and so if it's being restartet, the service for it doesn't have any endpoints. When I access this service via Traefik ingress, I'm getting a 404 during the time without endpoints.
I thought using the retry middleware would help in this case, because the ultimate goal would be to hold the connections for up to a given time instead of returning a 404. Is that even possible?

Initially, I used leader election with hot standby, but because the deployment is just a <2MB pod, just starting a new pod on a different machine was always faster than waiting for the semaphore to switch, plus automated updates are a pain with leader election, because it happened far too often that a "dying" pod received leader for 0.2s, which wasn't that great at all. So now I'm trying to find a way to simulate hot standby in a different way. Hoping to find some advice here

  • Nadyita