Configure PodDisruptionBudgetο
Before you beginο
Write manifest fileο
Here is an example of PodDisruptionBudget manifest yaml:
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: mercari-echo-jp
namespace: mercari-echo-jp-prod
spec:
maxUnavailable: 33%
selector:
matchLabels:
app: mercari-echo-jp
For example, with a maxUnavailable of 33%, evictions are allowed as long as no more than 33% of the desired replicas are unhealthy.
If you follow the resource request/limit guidelines, it is recommended to use a maxUnavailable: 33% PDB.
β οΈ Avoid specifying number of replicasο
If you specify number of replicas (e.g. 5) instead of percentage (e.g. 33%), you will get unexpected disruption when the pods auto scales.
For example, instead of using:
spec:
maxUnavailable: 5 # bad: will cause problems with autoscaling
it is recommended to use a percentage:
spec:
maxUnavailable: 33% # good