Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a Kubernetes rolling-update gracefully remove pods from a service load balancer

Tags:

kubernetes

Standard practice for a rolling update of hosts behind load balancer is to gracefully take the hosts out of rotation. This can be done by marking the host "un-healthy" and ensuring the host is no longer receiving requests from the load balancer.

Does Kubernetes do something similar for pods managed by a ReplicationController and servicing a LoadBalancer Service?

I.e., does Kubernetes take a pod out of the LoadBalancer rotation, ensure incoming traffic has died-down, and only then issue pod shutdown?

like image 252
Chris Willmore Avatar asked Sep 20 '25 15:09

Chris Willmore


1 Answers

Actually, once you delete the pod, it will be in "terminating" state until it is destroyed (after terminationGracePeriodSeconds) which means it is removed from the service load balancer, but still capable of serving existing requests.

We also use "readiness" health checks, and preStop is synchronous, so you could make your preStop hook mark the readiness of the pod to be false, and then wait for it to be removed from the load balancer, before having the preStop hook exit.

like image 150
Brendan Burns Avatar answered Sep 22 '25 08:09

Brendan Burns