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.
Master GitHub Actions with a Senior Infrastructure Engineer
As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.
Not sure yet? Check out the archive.
Unsubscribe at any time.