Cover for unhealthy pods

4/3/2020

I am running multiple pods with python/gunicorn serving web request. At times, request get really slow (up to 60s) which blocks all workers and makes the livenessProbe fail.

In some instances, all pods are blocked in this state and are restarted at the same time (graceful shutdown takes up to 60s). This means that no pod is available to take new requests.

Is there a way of telling k8s to cover for pods that it is restarting? For example starting a new pod when other pods are unhealthy.

-- Heinrisch
google-kubernetes-engine
kubernetes

1 Answer

4/3/2020

You can have an ingress or a load balancer at L7 layer which can route traffic to kubernetes service which can have multiple backend pods(selected by labels of the pods and label selector of the service) which spread across different deployments running in different nodes. The ingress controller or loadbalancer can do health check on backends and stop routing traffic to unhealthy pods.This topology overall increases the availability and resiliency of the application.

-- Arghya Sadhu
Source: StackOverflow