Does a K8s service re-send requests when readinessProbe fails?

3/23/2018

A service dispatches to multiple replicas of a deployment (default round-robin).

The backend instances temporarily have to go offline, i.e. they will close their port 80, take some time, and then open the port again.

deployment.yaml is using readinessProbe to regularly check which backend instances are ready to serve requests.

But what happens in the following scenario?

1) readiness check backend A: OK
2) backend A goes offline
3) requests to service is forwarded to backend A
4) readiness check backend A: fail

Will the service send the request again but to another backend instance, or is it lost?

-- Tobias Hermann
kubernetes

1 Answer

3/23/2018

It depends on the type of Service.

If the Service is a ClusterIP or NodePort, it's instantiated as iptables rules. Packets destined for the now offline pod will be undeliverable, causing the request to timeout.

If the Service is a LoadBalancer, the implementation is an application, like nginx or an equivalent. It will watch for timeouts, and generally speaking- though dependent on configuration- will retry, allowing the request to make it to an online pod.

-- Jonah Benton
Source: StackOverflow