PodDisruptionBudget not effective on Minikube

4/4/2020

I wanted to test PDB policy effectiveness on local minikube setup.

  • Created a NGINX deployment with replicas=5.
  • Created a PDB for NGINX to minAvailable=2. Shows AllowedDisruptions=3.
  • Updated deployment with replicas=0.
  • All NGINX pods were killed and deployment showed 0/0 despite PDB being in effect.
  • Now PDB shows AllowedDisruptions=0.

Why was PDB not respected and stopped from killing all the pods?

Is this is a testable scenario or my understanding of pod eviction which respects PDB not correct? Please advise.

-- AbhishekN
kubernetes
minikube

1 Answer

4/4/2020

The recommended way to test PDB is by draining a node.Updating the replica count is not considered a disruption. PDB kicks in when a pod is evicted using the eviction API which happens while draining a node.

Here is the list of involuntary disruptions

  1. a hardware failure of the physical machine backing the node
  2. cluster administrator deletes VM (instance) by mistake
  3. cloud provider or hypervisor failure makes VM disappear
  4. a kernel panic
  5. the node disappears from the cluster due to cluster network partition eviction of a pod due to the node being out-of-resources.

Here is the list of voluntary disruptions

  1. deleting the deployment or other controller that manages the pod
  2. updating a deployment’s pod template causing a restart
  3. directly deleting a pod (e.g. by accident)

https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#how-disruption-budgets-work

-- Arghya Sadhu
Source: StackOverflow