2 min read | by Jordi Prats
In Kubernetes we can configure a PodDisruptionBudgets (PDB) to tell the cluster for a given set of Pods how they can tolerate interruptions (such as application upgrades) maintaining it's general availability.
This Kubernetes object has graduated to GA in Kubernetes v1.21
A PodDisruptionBudget has three fields:
For both minAvailable and maxUnavailable we can set it as an absolute number or a percentage
For example, to tell the cluster that we want at least 3 replicas for the Pods that have the label "ampa=web" we would create the following PDB:
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: ampa-web
spec:
selector:
matchLabels:
ampa: web
minAvailable: 3
We can tell it that we don't want any interruptions at all setting maxUnavailable to zero:
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: ampa-web
spec:
selector:
matchLabels:
ampa: web
maxUnavailable: 0
By using this PDB we won't be tolerating any evictions so we will have to either delete the PDB if we want to allow some interruption or manually delete the Pod
Although this object is intented to be applied to a set of pods, we can use it on bare pods with the following restrictions:
Posted on 03/08/2021