Container Missing Liveness Probe
Detect containers without livenessProbe or readinessProbe configurations. Learn why health checks are essential for reliable Kubernetes deployments.
Health Checks
Detailed Explanation
Health Probes in Kubernetes
Kubernetes uses health probes to determine whether a container is alive and ready to serve traffic. Without probes, Kubernetes has no way to detect application-level failures — it only knows if the container process is running.
Example Without Probes
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-server
labels:
app: api
spec:
replicas: 3
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
securityContext:
runAsNonRoot: true
containers:
- name: api
image: api-server:3.2.1
ports:
- containerPort: 8080
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
What the Validator Flags
- Warning: Container 'api' has no livenessProbe
- Info: Container 'api' has no readinessProbe
Three Types of Probes
| Probe | Purpose | What Happens on Failure |
|---|---|---|
| livenessProbe | Is the container alive? | Container is restarted |
| readinessProbe | Can it accept traffic? | Removed from Service endpoints |
| startupProbe | Has it finished starting? | Other probes are disabled until success |
Probe Configuration Example
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 15
periodSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
startupProbe:
httpGet:
path: /healthz
port: 8080
failureThreshold: 30
periodSeconds: 10
Probe Types
- httpGet: Performs an HTTP GET request
- tcpSocket: Checks if a port is open
- exec: Runs a command inside the container
- grpc: Performs a gRPC health check (k8s 1.27+)
Use Case
Adding health checks to Kubernetes deployments to enable automatic restarts for unhealthy containers and proper traffic routing during rolling updates.