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 non-compliant containers
    • Run on: any machine with kubectl access
  2. For pods owned by higher-level controllers, patch the controller to add requests
    • Run on: any machine with kubectl access
    • For each non-compliant line with owner=<Kind>/<namespace>/<name>/..., edit that owner, not the pod. Example for a Deployment:
    • Adjust NAMESPACE, DEPLOYMENT_NAME, CONTAINER_NAME, and choose CPU/memory values appropriate for the workload.
  3. For standalone Pods (no owner), export, edit, and re-apply with requests
    • Run on: any machine with kubectl access
    • Edit /tmp/pod-POD_NAME.yaml and under each affected container add, or update, for example:
    • Delete and recreate the pod from the edited manifest (standalone pods only):
  4. For controllers managed via GitOps or IaC, update the source manifests
    • Run in your Git/IaC workflow; apply from any machine with kubectl access.
    • In each manifest (e.g., Deployment/StatefulSet/DaemonSet), ensure every container under spec.template.spec.containers defines resources.requests.cpu and resources.requests.memory as in step 3, then apply:
  5. Wait for rollouts to complete
    • Run on: any machine with kubectl access
  6. Verification (re-run the audit and confirm no is_compliant=false)
    • Run on: any machine with kubectl access
    • Confirm there are no lines with is_compliant=false.
On any machine with kubectl access:
  1. Identify non-compliant Pods and their controllers
For each line, note:
  • ownerKind/ownerName if present (Deployment, StatefulSet, DaemonSet, Job, CronJob, etc.).
  • If no ownerKind, you will edit the Pod template directly where it is defined (usually a standalone Pod manifest).
  1. Patch a controller-managed workload (example: Deployment)
Replace NAMESPACE, DEPLOYMENT_NAME, CONTAINER_NAME, and the CPU/memory values with your desired requests. This modifies the Pod template so all new Pods are compliant.
If the target container is not index 0, get its index first:
Then use that index instead of 0 in the JSON patch path.For other controllers, use the corresponding kind:
  1. Patch a standalone Pod (not recommended long term but possible)
For Pods with no ownerKind/ownerName, you must edit the source manifest and re-apply it. If you only have the live object, you can patch it (changes are lost when the Pod is recreated):
Again, adjust the container index as needed using:
  1. Prefer declarative manifests for ongoing management
Edit your YAML manifests (Deployment, StatefulSet, etc.) so each container has:
Then apply:
  1. Verification
Run the original audit command to confirm all containers have CPU and memory requests set: