Skip to main content

More Info:

Advisory: define a PodDisruptionBudget for each multi-replica Deployment so node drains and rollouts keep a minimum number of pods available.

Risk Level

Informational

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify multi-replica Deployments that lack a PodDisruptionBudget
    Run on: any machine with kubectl access
  2. For one non-compliant Deployment, capture its labels to use in the PodDisruptionBudget selector
    Run on: any machine with kubectl access
    Replace NAMESPACE and DEPLOYMENT_NAME as needed:
    Note the key/value pairs; these must be copied exactly into the PodDisruptionBudget’s spec.selector.matchLabels.
  3. Decide the availability requirement for this Deployment and choose the PodDisruptionBudget spec
    Run on: any machine with kubectl access
    Typical choices:
    • To always keep at least one pod running:
    • Or to allow only 1 pod at a time to be disrupted in a 3+ replica Deployment:
    Ensure the chosen value makes sense given .spec.replicas for this Deployment.
  4. Create a PodDisruptionBudget manifest for the Deployment using its pod labels
    Run on: any machine with kubectl access
    Example template; replace NAMESPACE, PDB_NAME, and the labels under matchLabels with the exact values from step 2:
    Ensure matchLabels matches a subset of the pod template labels of the target Deployment so the PDB actually selects its pods.
  5. Apply the PodDisruptionBudget to the cluster
    Run on: any machine with kubectl access
  6. Verification: confirm all multi-replica Deployments now have at least one matching PodDisruptionBudget
    Run on: any machine with kubectl access
    Ensure all listed Deployments show is_compliant=true; if any show is_compliant=false, repeat steps 2–5 for those Deployments.
On any machine with kubectl access:
  1. Identify a multi‑replica Deployment needing a PDB (example: namespace production, deployment web-app):
Note the pod template labels under spec.template.metadata.labels. Example:
  1. Create a PodDisruptionBudget manifest that selects those labels and enforces a minimum number of available pods. Example (adjust labels, name, and minAvailable/maxUnavailable per your SLOs):
  1. Apply the PDB:
  1. Repeat steps 1–3 for each Deployment with spec.replicas > 1, ensuring each PDB’s spec.selector.matchLabels exactly matches the Deployment’s pod template labels.
  2. Verification (cluster‑wide, same logic as the audit):