We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Readiness Probes

Okay, so a liveness probe answers the question, "should this container be restarted?", but a readiness probe answers a different one: "should this pod actually get traffic?"

So, when a pod fails its readiness probe, it isn't restarted. Instead:

  • It's marked as not ready (0/1 in the READY column)

  • It's removed from its service's endpoints, so it stops getting traffic

Once it passes its checks again, traffic resumes automatically.

readinessProbe:
  httpGet:
    path: /
    port: 8080
  periodSeconds: 5

Readiness probes allow for zero-downtime "maintenance windows", so that traffic doesn't actually get sent to a pod until it's truly ready to handle it. For example, a web server might be healthy (we don't want to kill it) but want to temporarily stop receiving traffic while it does some background work, like:

  • Processing a large video file

  • Rebuilding a cache

  • Switching to a new database connection

  • etc.

And with a readiness probe, the server can just return a "not ready" response until it's done, and Kubernetes will keep it out of the load balancer until then.

Assignment

Add a readiness probe to the web app, then break it.

  1. The old web pod is still around, serving traffic, because the rolling update won't remove it until the new pod is ready.

Submit the shell checks.