0 votes
in Kubernetes K8s by
What is PDB (Pod Disruption Budget)?

1 Answer

0 votes
by

A Pod Disruption Budget (PDB) is a Kubernetes resource that allows you to set policies on how many Pods of a particular ReplicaSet or Deployment can be simultaneously unavailable during voluntary disruptions. Voluntary disruptions can occur during planned maintenance, scaling events, or other administrative actions.

The main purpose of a Pod Disruption Budget is to ensure high availability and reliability of applications running in a Kubernetes cluster while allowing for necessary maintenance and updates. By setting a PDB, you define the maximum tolerable disruption to a group of Pods, ensuring that a minimum number of replicas remain available and operational at all times.

A typical use case for PDB is during rolling updates or scaling events. When you update a deployment or scale it up or down, Kubernetes will try to ensure that the disruption does not exceed the defined PDB. This prevents scenarios where all instances of an application are taken down simultaneously, leading to service outages or degraded performance.

Here’s how a Pod Disruption Budget is defined in a Kubernetes manifest:

“`yaml

apiVersion: policy/v1beta1

kind: PodDisruptionBudget

metadata:

  name: example-pdb

spec:

  selector:

    matchLabels:

      app: example-app

  maxUnavailable: 1

“`

In this example, we create a Pod Disruption Budget named “example-pdb” for Pods labeled with `app: example-app`. The `maxUnavailable` parameter is set to 1, meaning that only one Pod can be unavailable at any time due to voluntary disruptions.

It’s important to note that a PDB does not prevent involuntary disruptions caused by node failures or other unforeseen issues. Instead, it focuses on controlling voluntary disruptions to maintain application availability during planned events. PDBs are particularly useful for applications that require a certain level of redundancy or have strict availability requirements.

...