study.

Separate Readiness Failure from Restarts · CKAD

Removing an unready app from traffic is different from restarting it.

← CKAD

Learn with progress and quizzes

First, understand the concepts.

Readiness

A failed readiness probe marks the container unready and removes it from ordinary Service traffic. It does not itself restart the container.

Liveness and startup

Liveness can trigger restarts when an app cannot recover. Startup probes delay liveness and readiness checks while a slow application initializes.

Controlled experiment

Using file existence as a readiness condition lets you change readiness while the same process keeps running. Running and Ready are different states.

Why it matters

A live process may still be loading data and not ready for traffic. Readiness addresses serving ability; liveness addresses failures that warrant restart.

Work through the reasoning

Connect results to actions

Readiness failure changes readiness. Liveness failure reaching its threshold can cause restart. A configured startup probe prevents liveness and readiness checks until startup succeeds.

Expect observation delay

File changes do not necessarily update status immediately. Read periods and thresholds and wait for conditions. Observe file presence, Ready, and restartCount together to separate readiness from restarts.

Learn by doing.

Use kubectl, a personal practice Kubernetes cluster, and a POSIX shell. Each lab uses its own namespace. Use example values only in Secrets. Cleanup removes the entire practice namespace.

Start a Pod without its readiness file and observe Running with Ready=false. Create the file to become ready, then remove it to become unready again.

kubectl config current-context
kubectl create namespace study-ckad-probes --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n study-ckad-probes -f - <<'YAML'
apiVersion: v1
kind: Pod
metadata:
  name: probe
spec:
  containers:
  - name: app
    image: busybox:1.36
    command: ["sleep", "3600"]
    readinessProbe:
      exec:
        command: ["test", "-f", "/tmp/ready"]
      periodSeconds: 2
      failureThreshold: 1
YAML
kubectl wait --for=jsonpath='{.status.phase}'=Running pod/probe -n study-ckad-probes --timeout=120s
kubectl get pod probe -n study-ckad-probes
kubectl exec probe -n study-ckad-probes -- touch /tmp/ready
kubectl wait --for=condition=Ready pod/probe -n study-ckad-probes --timeout=30s
kubectl exec probe -n study-ckad-probes -- rm /tmp/ready
kubectl wait --for=condition=Ready=false pod/probe -n study-ckad-probes --timeout=30s
kubectl get pod probe -n study-ckad-probes -o jsonpath='{.status.containerStatuses[0].restartCount}'

How to check your result

Expect false → true → false while restartCount remains zero. Probe periods and thresholds can delay changes. If waiting times out, inspect probe failure events with describe.

Clean up practice resources

Run after checking the result. Confirm these resources belong to your practice run and contain no data you need to keep.

kubectl delete namespace study-ckad-probes

Apply what you learned

Initialization takes 90 seconds but liveness fails after 10. Which probe role should you review?

Reveal the reasoning after trying

Consider a startup probe with a sufficient initialization budget. After startup, use liveness for unrecoverable stalls and readiness for serving decisions. This differs from simply allowing every failure indefinitely.

Ready to check your understanding?

Which outcome is not normally caused by readiness failure alone?

  1. Ready becomes false
  2. Removal from Service targets
  3. Container restart
  4. Reduced delivery of new requests
Reveal the reasoning after trying

Container restart

Readiness indicates whether traffic can be served. Restarts relate to other conditions, such as liveness or startup failures and process exits.

Official documentation · Separate Readiness Failure from Restarts · Further reading · official documentation