kubernetes: specifying maxUnavailable in both Deployment and PDB

9/23/2019

Assuming I have a Deployment with a specific value set to the .spec.strategy.rollingUpdate.maxUnavailable field.

Then I deploy a PodDisruptionBudget attached to the deployment above, setting its spec.maxUnavailable field to a value different to the above.

Which one will prevail?

-- pkaramol
kubernetes

1 Answer

9/23/2019

By interpreting the documentation, it seems that it depends on the event.

For a rolling update, the Deployment's maxUnavailable will be in effect, even if the PodDisruptionBudget specifies a smaller value.

But for an eviction, the PodDisruptionBudget's maxUnavailable will prevail, even if the Deployment specifies a smaller value.


The documentation does not explicitly compare these two settings, but from the way the documentation is written, it can be deduced that these are separate settings for different events that don't interact with each other.

For example:

Also, this is more in the spirit of how Kubernetes works. The Deployment Controller is not going to read a field of a PodDisruptionBudget, and vice versa.

But to be really sure, you would just need to try it out.

-- weibeld
Source: StackOverflow