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 offending pods and their owners (run on any machine with kubectl access):
  2. For each non-compliant workload that is controlled by a higher-level object (e.g., Deployment, StatefulSet, DaemonSet), export its manifest for editing (run on any machine with kubectl access; replace values with those from step 1):
    (Similarly use statefulset or daemonset in place of deployment as needed.)
  3. Edit the manifest to add livenessProbe and readinessProbe for each long-running container (run on the same machine where you saved the file):
    Under spec.template.spec.containers[] for each long-running container, add probes appropriate to the application, for example:
    Adjust paths, ports, and timings to match the container’s behavior.
  4. Apply the updated manifest so the controller recreates pods with probes (run on any machine with kubectl access):
    Repeat steps 2–4 for each affected Deployment/StatefulSet/DaemonSet.
  5. For any standalone Pod objects that you intentionally manage directly (no controller owner), edit and re-apply the Pod manifest (run on any machine with kubectl access):
    Add livenessProbe and readinessProbe under spec.containers[] as in step 3, then:
  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 (Deployments, etc.):
  1. For each owning controller (example: Deployment my-app in namespace prod), export its manifest:
  1. Edit /tmp/deploy-my-app.yaml and add livenessProbe and readinessProbe to each long-running container. Example HTTP-based probes:
Apply the updated manifest:
Repeat for all affected controllers (Deployments, StatefulSets, DaemonSets, Jobs/CronJobs if they are long-running).
  1. If any pod is standalone (kind: Pod) and managed directly (not recommended in AKS), edit in place:
Add livenessProbe and readinessProbe under the container spec as shown above, then save and exit; the pod will be recreated if the spec changes in a controller, or updated in place for a bare pod.
  1. Verification (any machine with kubectl access):