Skip to main content

More Info:

Advisory: long-running containers should define livenessProbe and readinessProbe so Kubernetes can restart hung pods and keep traffic off pods that are not ready.

Risk Level

Informational

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify the noncompliant pods and their owning workload (Deployment, StatefulSet, DaemonSet, etc.). Run on any machine with kubectl access:
    For each listed pod, get its controller:
  2. For each owning workload, export the current manifest. Run on any machine with kubectl access:
  3. Edit the manifest to add livenessProbe and readinessProbe to each long‑running container. Run on any machine with kubectl access:
    Under spec.template.spec.containers[]. for each applicable container, add probes suited to the app. Example HTTP container snippet (adapt values for your app):
    For non-HTTP apps, use tcpSocket or exec probes instead of httpGet, as appropriate.
  4. Apply the updated workload manifests. Run on any machine with kubectl access:
    Kubernetes will perform a rolling update; pods for that workload will be recreated with the new probes.
  5. For standalone Pods not managed by a controller (if any), edit them or their source manifests, understanding that direct kubectl edit pod is ephemeral. Prefer updating the underlying manifest and re-creating the pod:
  6. Verify that all long‑running containers now define both probes. Run on any machine with kubectl access:
On any machine with kubectl access:
  1. Identify non-compliant pods and their controllers (Deployment/StatefulSet/etc.):
  1. For each long-running workload (example: a Deployment my-app in namespace prod), export the current manifest:
  1. Edit the manifest to add livenessProbe and readinessProbe under each long-running container in spec.template.spec.containers. Example patch to apply inside a container spec:
Adjust probe type, paths, ports, and timings to match the container.
  1. Apply the updated manifest:
Repeat steps 2–4 for each affected Deployment/StatefulSet/DaemonSet or standalone Pod that represents a long-running workload.
  1. Verification (same audit logic):