PodDisruptionBudgetď
What is âPodDisruptionBudgetâ?ď
âPodDisruptionBudgetâ is a Kubernetes object which limits the number pods of a replicated application that are down simultaneously from voluntary disruptions.
Why âPodDisruptionBudgetâ is needed to be configured?ď
If âPodDisruptionBudgetâ is not configuredď
Letâs say, your microservice is running on a Kubernetes cluster with âPodDisruptionBudgetâ and configured 2 replicas like this:
apiVersion: apps/v1
kind: Deployment
metadata:
name: your-microservice
namespace: your-namespace
spec:
replicas: 2
...
The cluster has 3 nodes and your microserviceâs pods âapp-1â and âapp-2â are running on ânode-1â and ânode-2â:

Now a cluster administrator (Microservices Platform member) is going to drain node-1 in order to upgrade the cluster:

âapp-1â is now terminating and a new pod âapp-3â is pending state. At this point, if the cluster administrator tries to drain ânode-2â:

What happened? Yes, you donât have any healthy pods now.
PodDisruptionBudget protects your microservices from this situation.
If âPodDisruptionBudgetâ is configuredď
Now you have same microservice with âPodDisruptionBudgetâ like this:
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: your-microservice
namespace: your-namespace
spec:
minAvailable: 50% # 50% is just to keep the example simple, it is not the recommended value
selector:
# ...
Even if the cluster administrator tries to drain ânode-2â, it will block because there is only 1 available pod.

Thatâs why âPodDisruptionBudgetâ is needed to be configured for your microservices.