Is PDB required for a kubernetes cluster for which HPA is defined?

7/27/2020

I have a Kubernetes cluster. Through policies, I have made sure that all the services have Requests, Limits and HPA defined so that I can have smooth autoscaling. I have also defined ResourceQuota. In such a scenario, is there a need to define PDB as well? Please advise.

-- Sormita Chakraborty
autoscaling
azure-aks
horizontal-pod-autoscaling
kubernetes

1 Answer

7/27/2020

Definitely, PDBs are meant to complement your replica set to ensure that node operation won’t bring down your services by removing all the required instances from running at the same time. It is a resource that looms at the number of running replicas and leverages the pod label selector (same as the service ) to identify which pod your PDBs should be look at

During a node operation, the drain will halt and wait that all PDBs are respected when performing pod eviction. Pods that if evicted would cause a PDB to be invalid would wait till the condition would be valid.

What you need to be careful is to have the right definition. A PDB for a deployment with a single replica will most likely cause the node operation to never succeed.

For more details, have a look at this articles

https://blog.gruntwork.io/avoiding-outages-in-your-kubernetes-cluster-using-poddisruptionbudgets-ef6a4baa5085

And For full details on what the resource manifest is

https://kubernetes.io/docs/tasks/run-application/configure-pdb/

-- djsly
Source: StackOverflow