Skip to main content

More Info:

Verifies every container sets resources.requests so the scheduler can place the pod correctly and QoS is not BestEffort.

Risk Level

Low

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. List all non-exempt pods and identify offenders (run on any machine with kubectl access):
  2. For a pod managed by a higher-level controller (Deployment/ReplicaSet/StatefulSet/DaemonSet/Job/CronJob), get and edit the owning object’s manifest (example for a Deployment; run on any machine with kubectl access):
    Under each container in spec.template.spec.containers, add or update:
    (Choose values appropriate for the application.)
  3. Apply the updated controller manifest (run on any machine with kubectl access):
    Repeat steps 2–3 for other controller types (kubectl get statefulset, kubectl get daemonset, kubectl get job, kubectl get cronjob) that own non-compliant pods.
  4. For stand-alone Pods (no controller ownerReference), edit the Pod spec directly (run on any machine with kubectl access):
    In each spec.containers[], ensure:
    Note: editing certain fields of a running Pod may be restricted; if so, recreate the Pod with a corrected manifest:
  5. For workloads managed by AKS add-ons or third-party operators, adjust their Helm chart values or operator configuration so that the generated Pod templates include resources.requests.cpu and resources.requests.memory for all containers, then redeploy using the add-on’s/Helm’s normal process.
  6. Verify compliance for all pods (run on any machine with kubectl access):
    The output should be is_compliant=true.
On any machine with kubectl access:
  1. Identify non-compliant pods and their controllers
Focus on the owning workload (Deployment, StatefulSet, Job, etc.), not the pod itself.
  1. Export the owning workload manifest (example for a Deployment)
  1. Edit containers to add resources.requests (CPU and memory) in the manifest
In /tmp/deploy-with-requests.yaml, under each container in spec.template.spec.containers, ensure a block like:
Adjust values to match application requirements. Do this for every container that currently lacks requests or has only one of CPU/memory.
  1. Apply the updated manifest
Repeat steps 2–4 for each affected controller type (e.g., kubectl get statefulset, kubectl get job, etc.).
  1. For standalone Pods managed directly (no ownerReferences)
Export, edit, and re-create (pods are immutable):
Edit each container to add:
Remove runtime-only fields before re-creating:
  1. Verification
Run the original audit and confirm all listed rows have is_compliant=true (or that it prints just is_compliant=true):