>_ IzzyLab

Hands-on task

This task is step 14 of the course “Kubernetes: manifests from Namespace to RBAC”

Readiness probe

easy~11 min

The Kubernetes cluster in this sandbox (kubectl is already configured) has a ConfigMap web-conf with an nginx config in which the /healthz path answers ok. /root/probes.yaml holds a Deployment web (image nginx:1.27-alpine, config mounted from web-conf) with no readiness probe. Open the file in the Editor tab and give the container a readinessProbe — an HTTP GET on the path /healthz, port 80. Then apply the manifest to the cluster: the pod must become ready, which means the probe really passes.

What you'll practise:
  • kubernetes
  • readinessprobe
  • healthcheck
  • yaml
  • yq
  • kubectl apply

Topic breakdown

Kubernetes distinguishes "the pod is running" from "the pod is ready to accept traffic": the second is handled by readinessProbe. Until the probe passes, the pod is removed from the service's endpoints and no requests go to it, but it isn't restarted — that's the job of a separate livenessProbe. An HTTP probe is set by an httpGet block with the fields path and port inside the container's description in spec.template.spec.containers[]. Being valid against the schema isn't enough: if the probe looks at a path or port where the application doesn't answer 2xx, the pod stays not ready — kubectl describe pod shows it as Readiness probe failed events.

What's checked

  1. Manifest is valid
  2. readinessProbe on /healthz
  3. readinessProbe on port 80
  4. web in the cluster has a probe on /healthz
  5. the web pod is ready

What it looks like