Liveness probes are essential for application availability. Without them, Kubernetes cannot determine if an application is unresponsive and needs to be restarted.
apiVersion: rules.spotter.dev/v1alpha1
kind: SpotterRule
metadata:
name: spotter-config-002
labels:
severity: "medium"
category: "config"
annotations:
rules.spotter.dev/title: "Liveness Probe Not Set"
rules.spotter.dev/version: "1.0.0"
rules.spotter.dev/cwe: "CWE-248"
rules.spotter.dev/description: "Liveness probes are essential for application availability. Without them, Kubernetes cannot determine if an application is unresponsive and needs to be restarted."
spec:
match:
resources:
kubernetes:
apiGroups:
- ""
- "apps"
versions:
- "v1"
kinds:
- Pod
- Deployment
- StatefulSet
- DaemonSet
namespaces:
include: ["*"]
exclude: ["kube-system", "kube-public"]
labels:
exclude:
rules.spotter.dev/ignore: ["true"]
cel: |
(object.kind == 'Pod' && has(object.spec.containers) && object.spec.containers.exists(c, !has(c.livenessProbe))) ||
(object.kind != 'Pod' && has(object.spec.template.spec.containers) && object.spec.template.spec.containers.exists(c, !has(c.livenessProbe)))
remediation:
manual: "Define a liveness probe for each container in the pod spec."
references:
- title: "Configure Liveness, Readiness and Startup Probes"
url: "https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/"