The PodDisruptionBudget with minAvailable=0 prevents RHOCP node drain if 0 pods are in the running state in the RHOCP4

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4.12

Issue

  • The PodDisruptionBudget(PDB) with minAvailable=0 prevents RHOCP node drain even if 0 pods are running in the RHOCP4.
  • RHOCP Node drain is failing due to PodDisruptionBudget(PDB) with minAvailable=0.

    error when evicting pods/"mypod" -n "test" (will retry after 5s): Cannot evict pod as it would violate the pod's 
    disruption budget.
    

Resolution

  • With a PodDisruptionBudget(PDB) that has the unhealthyPodEvictionPolicy set to AlwaysAllow, the PodDisruptionBudget can drain nodes and evict the pods for a malfunctioning application guarded by this PodDisruptionBudget.
  • Create a YAML file that defines a PodDisruptionBudget object and specify the unhealthyPodEvictionPolicy:

    apiVersion: policy/v1
    kind: PodDisruptionBudget
    metadata:
    name: my-pdb
    spec:
    minAvailable: 0
    selector:
      matchLabels:
        name: my-pod
    unhealthyPodEvictionPolicy: AlwaysAllow <==========
    

Root Cause

  • In the RHOCP 4.12 or lower versions, the RHOCP node drains fail for a malfunctioning application guarded by the PodDisruptionBudget.
  • The unhealthyPodEvictionPolicy filed in PodDisruptionBudget was introduced in the RHOCP 4.13 Version.

Diagnostic Steps

  • Check the PodDisruptionBudget configurations:
$ oc get pdb <pdb_name> -0 yaml
  • Check the pod status:
$ oc get po -n <project name>

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments