Ensure liveness probe is configured

Error: Liveness probe is not configured

Bridgecrew Policy ID: BC_K8S_7
Checkov Check ID: CKV_K8S_8
Severity: LOW

Liveness probe is not configured

Description

The kubelet uses liveness probes to know when to schedule restarts for containers. Restarting a container in a deadlock state can help to make the application more available, despite bugs.

If a container is unresponsive, either to a deadlocked application or a multi-threading defect, restarting the container can make the application more available, despite the defect.

Fix - Buildtime

Kubernetes

  • Resource: Container
  • Field: livenessProbe (Optional)
    The probe describes a health check to be performed against a container to determine whether it is alive or not.
    Its arguments may include: exec, failureThreshold, httpGet, initialDelaySeconds, periodSeconds, successThreshold, tcpSocket and timeoutSeconds.
apiVersion: v1
kind: Pod
metadata:
  name: <name>
spec:
  containers:
  - name: <container name>
    image: <image>
+   livenessProbe:
      <Probe arguments>