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. On any machine with kubectl access, list non-compliant multi‑replica Deployments so you know what needs a PodDisruptionBudget:
  2. For one non‑compliant Deployment, capture its pod template labels and replica count (needed for the PDB selector and minAvailable / maxUnavailable):
  3. On any machine with kubectl access, create a PodDisruptionBudget manifest file for that Deployment, using the pod template labels in spec.selector.matchLabels. For example, save as pdb-<deployment-name>.yaml:
    Adjust minAvailable (or alternatively use maxUnavailable) according to how many replicas must remain available during disruptions.
  4. Apply the PodDisruptionBudget:
  5. Repeat steps 2–4 for each remaining non‑compliant multi‑replica Deployment identified in step 1, ensuring each PDB’s spec.selector.matchLabels exactly matches the Deployment’s pod template labels you want protected.
  6. Verify all multi‑replica Deployments now have at least one matching PodDisruptionBudget by rerunning the audit command on any machine with kubectl access:
    Confirm that every listed multi‑replica Deployment now shows is_compliant=true and podDisruptionBudgets greater than 0.
Repeat step 2–3 for each multi-replica Deployment, ensuring:
  • metadata.namespace matches the Deployment’s namespace.
  • spec.selector.matchLabels exactly matches the labels on .spec.template.metadata.labels of the Deployment’s pods (at least one stable, unique label such as app: <name>).
You can bulk-generate skeleton manifests to edit by hand, for example: