Graceful termination of kubernetes pods

2/20/2017

We have an application with 4 pods running with a load balancer! We want to try the rolling update, but we are not sure what happens when a pod goes down! The documentation is unclear! Particularly this quote from Termination Of Pods:

Pod is removed from endpoints list for service, and are no longer considered part of the set of running pods for replication controllers. Pods that shutdown slowly can continue to serve traffic as load balancers (like the service proxy) remove them from their rotations.

So, if someone can guide us on the following questions :

1.) When a pod is shutting down, can it still serve new requests? Or does the load balancer not consider it?

2.) Does it complete the requests it is processing till the grace-period is exhausted? and then kills the container even if any process is still running?

3.) Also, this mentions replication controllers, what we have is a Deployment and Deployment has replica sets, so will there be any difference?

We went through this question but the answers are conflicting without any source : Does a Kubernetes rolling-update gracefully remove pods from a service load balancer

-- Nagireddy Hanisha
kubernetes
load-balancing

1 Answer

2/20/2017

1) when a Pod is shutting down it's state is changed to Terminating and it is not considered by the LoadBalancer - as described in the Pod termination docs

2) Yes - you might want to look at the pod.Spec.TerminationGracePeriodSeconds configuration to gain some control. You'll find details in the API documentation

3) No - the ReplicaSet and the Deployment take care of scheduling Pods, there's no difference when it comes to the shutdown behaviour of the Pods

-- pagid
Source: StackOverflow