Skip to content

Readiness probe failed (statuscode 404): pod runs but stays 0/1

Kubernetestested on kind v0.33.0, Kubernetes v1.37.0

The new pod is Running but never 1/1. The readiness probe asks for a path that does not exist and gets 404. Kubernetes therefore sends the pod no traffic, and with maxUnavailable 0 the deployment does not remove any old pod.

Symptom

kubectl get pods -l app.kubernetes.io/name=api
NAME                   READY   STATUS    RESTARTS   AGE
api-55996cd6b-4gfjv    0/1     Running   0          25s
api-65f8d67cdc-4pnkk   1/1     Running   0          3m46s
api-65f8d67cdc-sr5n6   1/1     Running   0          3m55s
api-65f8d67cdc-vp6q8   1/1     Running   0          3m50s

In the course the new version's readiness points to /gibtsnicht. The rollout waits for a ready pod that never comes.

Diagnosis

The kubelet reports failed probes as events with reason Unhealthy.

kubectl get events --field-selector reason=Unhealthy \
  -o custom-columns=COUNT:.count,MESSAGE:.message
COUNT   MESSAGE
8       Readiness probe failed: HTTP probe failed with statuscode: 404

Causes

statuscode 404The probe asks for a path the application does not know

The application answers, but not with 2xx or 3xx. For the kubelet the pod is therefore not ready as long as the probe fails.

kubectl get endpointslice -l kubernetes.io/service-name=api -o jsonpath=\
'{range .items[*].endpoints[*]}{.targetRef.name}  ready={.conditions.ready}{"\n"}{end}'
api-65f8d67cdc-sr5n6  ready=true
api-65f8d67cdc-vp6q8  ready=true
api-65f8d67cdc-4pnkk  ready=true
api-55996cd6b-4gfjv  ready=false

rollout status exit 1The rollout stalls, the application keeps running

With maxUnavailable 0 the deployment waits for the new pod. rollout status with --timeout ends with exit 1 – that is how a pipeline detects a stuck rollout too.

kubectl rollout status deploy/api --timeout 5s
Waiting for deployment "api" rollout to finish: 1 out of 3 new replicas have been…
error: timed out waiting for the condition

Fix

Apply the file with the correct probe path again and wait for the rollout.
kubectl apply -f k8s/api.yaml
deployment.apps/api configured
service/api unchanged
kubectl rollout status deploy/api
deployment "api" successfully rolled out

Don't: Removing the readiness probe so the rollout completes. Then a broken pod gets traffic immediately.

▶
Break it yourself and find it – free
Kubernetes hands-on, Day 5: startup, readiness and liveness probes for notes and a rollout under load without errors.
Go to day 5 →

FAQ

Do users notice the broken readiness?

No. In the course the app keeps returning 200, because kube-proxy sends nothing to the pod with ready=false.

How does this differ from a failing liveness probe?

Readiness only takes the pod out of traffic. Liveness restarts the container, up to CrashLoopBackOff.

Related error patterns

More