Intro to Kubernetes Pod Disruption Budgets

Kubernetes has a resource called a Pod Disruption Budget or PDB.

It allows you to set how many pods should be available during a voluntary disruption.

An example of a voluntary disruption is when your nodes are scaling down, and Kubernetes needs to move your deployment’s pods to another node.

PDBs are easy to set up and look like this:

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: zk-pdb
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: zookeeper

The main thing you want to pay attention to is the maxUnavailable or minAvailable.

You want to set minAvailable to guarantee a certain number of pods remain up.

If you want to set how many pods can be disrupted, use maxUnavailable.

If you want to set how many pods can be disrupted, use maxUnavailable.

You should generally set a PDB for production workloads.


Like what you've read?

If you're an engineering leader or developer, you should subscribe to my 80/20 DevOps Newsletter. Give me 1 minute of your day, and I'll teach you essential DevOps skills. I cover topics like Kubernetes, AWS, Infrastructure as Code, and more.

Not sure yet? Check out the archive.

Unsubscribe at any time.