How does the failover mechanism work in kubernetes service?

2/18/2019

According to some of the tech blogs (e.g. Understanding kubernetes networking: services), k8s service dispatch all the requests through iptable rules.
What if one of the upstream pods crashed when a request happened to be routed on that pods.
Is there a failover mechanism in kubernetes service?
Will the request will be forwarded to next pod automatically?
How does kubernetes solve this through iptable?

-- George Liang
kube-proxy
kubernetes

1 Answer

2/18/2019

Kubernetes offers a simple Endpoints API that is updated whenever the set of Pods in a Service changes. For non-native applications, Kubernetes offers a virtual-IP-based bridge to Services which redirects to the backend Pods

Here is the detail k8s service & endpoints

So your answer is endpoint Object

kubectl get endpoints,services,pods

There are liveness and readiness checks which decides if the pod is able to process the request or not. Kubelet with docker has mechanism to control the life cycle of pods. If the pod is healthy then its the part of the endpoint object.

-- Suresh Vishnoi
Source: StackOverflow