Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubernetes: specifying maxUnavailable in both Deployment and PDB

Tags:

kubernetes

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?

like image 254
pkaramol Avatar asked Jan 01 '23 15:01

pkaramol


1 Answers

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:

  • Updating a Deployment
  • Output of kubectl explain deploy.spec.strategy.rollingUpdate.maxUnavailable
  • Specifying a PodDisruptionBudget
  • Output of kubectl explain pdb.spec.maxUnavailable

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.

like image 183
weibeld Avatar answered Jan 03 '23 04:01

weibeld