What happens to traffic to a temporary unavailable pod in a StatefulSet?

12/22/2019

I've recently been reading myself into kubernetes and want to create a StatefulSet for a service of mine.

As far as I understood, a StatefulSet with let's say 5 replicas offers certian dns entries to reach it.

E.g. myservice1.internaldns.net, myservice2.internaldns.net

What would now happen, if one of the pods behind the dns entries goes down, even if it's just for a small amount of time?

I had a hard time finding information on this.

Is the request held until the pod is back? Will it be router to another pod, possibly losing the respective state? Will it just straightup fail?

-- Sossenbinder
kubernetes

1 Answer

12/22/2019

If you're Pod is not ready, then the traffic is not forwarded to that Pod. So, your service will not load balance traffic to Pods that are not ready.

To decide if the given Pod is ready or not, you should define readinessProbe. I recommend reading the Kubernetes documentation on "Configure Liveness, Readiness and Startup Probes".

-- RafaƂ Leszko
Source: StackOverflow