Skip to main content

More Info:

Verifies pods are owned by a controller (Deployment, StatefulSet, DaemonSet, Job). A naked pod is not rescheduled if its node dies.

Risk Level

Low

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify naked pods (run on any machine with kubectl access):
  2. For each naked pod, export its manifest (run on any machine with kubectl access):
  3. Create a controller manifest from the pod spec (run on any machine with kubectl access; edit file with your editor of choice):
    • Open the exported file:
    • Remove metadata.uid, resourceVersion, creationTimestamp, status, and any ownerReferences.
    • Wrap the spec under a controller. For a typical Deployment, change the top-level keys to something like:
    • Adjust to StatefulSet, DaemonSet, or Job if more appropriate for the workload.
  4. Apply the new controller (run on any machine with kubectl access):
  5. Delete the original naked pod after confirming the controller-created pod is running (run on any machine with kubectl access):
  6. Verify no remaining naked pods (run on any machine with kubectl access):
On any machine with kubectl access:
  1. Identify naked pods (non-system namespaces)
  1. For each naked pod, export its spec as a template (example for namespace app-ns, pod my-app-pod):
Edit my-app-pod.yaml locally:
  • Remove fields that must not be in a controller spec:
    • metadata.uid
    • metadata.resourceVersion
    • metadata.creationTimestamp
    • metadata.ownerReferences
    • metadata.managedFields
    • metadata.selfLink, metadata.generation (if present)
    • spec.nodeName (unless you intentionally pin to a node; usually remove)
    • status section (remove entirely)
  • Decide the right controller type:
    • Deployment for stateless apps
    • StatefulSet for stateful apps needing stable identity
    • DaemonSet to run one pod per node
    • Job for finite work/batch
  1. Example: convert to a Deployment (stateless workload)
Transform my-app-pod.yaml into my-app-deployment.yaml like:
Apply it:
  1. Scale down and delete the original naked pod
If you need to avoid downtime:
  • Label the old pod so you can distinguish it (optional):
  • Once the Deployment pod is Ready, delete the naked pod:
  1. Example: convert to a Job (for one-off/batch pods)
Create my-batch-job.yaml:
Apply and remove the naked pod:
  1. Verification (same logic as the audit)