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
InformationalAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
On any machine with kubectl access, list non-compliant pods and note their namespaces, names, and owning controllers (Deployment/StatefulSet/Job/etc.):
-
For pods managed by a controller (recommended), edit the controller manifest and add probes. Example for a Deployment
my-appin namespaceprod:In thespec.template.spec.containers[]entry for each long-running container, add both probes, adapting paths/ports and thresholds to the app:Save and exit; the Deployment will roll out new pods automatically. -
For pods defined directly by a Pod manifest (no controller), edit the manifest and re-apply it. First, export the manifest:
Edit
/tmp/my-pod.yaml, add appropriatelivenessProbeandreadinessProbeunder the container, then delete and recreate the pod from the file: -
If your GKE workloads are managed by GitOps or another IaC system, locate the corresponding manifest in the repository and add the same
livenessProbeandreadinessProbefields under each long-running container, then commit and let your pipeline apply the changes instead of usingkubectl edit. -
After the updated workloads have rolled out and pods are running, verify compliance from any machine with kubectl access:
The output should be
is_compliant=true.
Using kubectl
Using kubectl
On any machine with kubectl access:(For other controllers, substitute Adjust paths, ports, and timings to match the application’s health endpoints and startup characteristics.This will roll out new pods with the probes defined.Edit
- Identify a non-compliant pod and export its owning workload
owner= field (e.g., Deployment/default/web-app/...). Then export the current manifest for that owner resource:deployment with statefulset, daemonset, etc.)- Edit the manifest to add probes
livenessProbe and readinessProbe under spec.template.spec.containers[]. Example HTTP-based probes:- Apply the updated manifest
- For bare Pods (no controller)
owner= is empty (a standalone Pod), fetch, modify, and re-create it (Pods cannot be updated in-place for some fields; recreate is safer):standalone-app-pod.yaml to add livenessProbe and readinessProbe under spec.containers[] as above, then delete and recreate:- Verification
Automation
Automation

