Kubernetes 101 : Keeping a microservice application alive - the PodDisruptionBudgets resource -
Kubernetes could stop pods for different reasons, either to move them pods around or remove them from a node that is scheduled for maintenance.
To keep an application - backed by pods - running and serving clients, we need to keep enough pod replicas alive.
To achieve that, we could use the PodDisruptionBudget object that tells kubernetes the percentage/number of pods that could be stopped for an application - while keeping the application alive -.
Below is an example of a PodDisruptionBudge object:
The "minAvailable" parameter tells kubernetes that at least six replicas of the pod with the label "run: nginx" should be running at all times.
Let's check our PodDisruptionBudget object using the below command - in case we have 9 = 6 - must have - + 3 - allowed to fail - pods running:
Remark:
The parameters of the PodDisruptionBudget can't be honored if a node hosting one of the pods fails while the number of available pods is at its minimum -"6" -.
We could also use the "maxUnavailable" parameter to let kubernetes know the maximum number of pods - that match the given label - that could be stopped.
Below is an example of the PodDisruptionBudget that uses the "maxUnavailable" parameter:
Remark:
Comments