44/64
Sign inSign up free

150. Add Readiness and Liveness Probes

medium 20 XP ~8 minHands-on lab90.0% acceptance

The reviews Deployment in namespace catalogs has no health checks. During the last release, users hit Pods that were still warming up, and a Pod that hung overnight kept running until someone restarted it by hand. The application listens on port 8080 (named http).

Task

  • The app container of Deployment reviews has a readiness probe: an HTTP GET on path /ready, port 8080, every 10 seconds.
  • It has a liveness probe: a TCP check on port 8080 that starts after 30 seconds and fails the container after 3 failed attempts.
  • Every replica of reviews is updated and available, and the image and replica count stay as they are.

A practice cluster is running on this machine: start with kubectl get deploy reviews -n catalogs -o yaml.

About this machine

Ubuntu 24.04 with a private practice cluster: a real Kubernetes API server, scheduler and controllers, and three nodes (controlplane, node01, node02). Containers run in a lightweight runtime: their commands, kubectl logs, exec and run -it work, and Pods reach Services by name with wget or curl. Images never download, and port-forward isn't available. k is an alias for kubectl, with completion. The grader checks the cluster's final state, not the commands you typed.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh machine with its own Kubernetes cluster starts in about half a minute, with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.