0
0
Kubernetesdevops~10 mins

Readiness probe concept in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Readiness probe concept
Pod starts
Kubelet runs readiness probe
Probe sends request to container
Container responds
Success?
NoPod marked NOT ready
Retry probe after delay
+--> Yes
Pod marked READY
Traffic routed to Pod
The readiness probe checks if a container is ready to receive traffic. If it succeeds, the pod is marked ready and receives traffic. If it fails, the pod is marked not ready and traffic is stopped.
Execution Sample
Kubernetes
readinessProbe:
  httpGet:
    path: /health
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10
This readiness probe sends an HTTP GET request to /health on port 8080 every 10 seconds, starting 5 seconds after the container starts.
Process Table
StepActionProbe ResultPod Readiness StateEffect
1Pod starts, wait 5 secondsNo probe yetNot ReadyNo traffic sent
2Send HTTP GET /healthSuccessReadyPod receives traffic
3Wait 10 secondsNo probeReadyTraffic continues
4Send HTTP GET /healthFailureNot ReadyTraffic stopped
5Wait 10 secondsNo probeNot ReadyNo traffic
6Send HTTP GET /healthSuccessReadyTraffic resumes
💡 Probe continues periodically; pod readiness state updates based on probe success or failure.
Status Tracker
VariableStartAfter Step 2After Step 4After Step 6
Pod ReadinessNot ReadyReadyNot ReadyReady
Probe ResultNoneSuccessFailureSuccess
Key Moments - 3 Insights
Why is the pod not ready immediately after starting?
Because the readiness probe has an initial delay (5 seconds) before it starts checking, as shown in step 1 of the execution_table.
What happens to traffic when the readiness probe fails?
The pod is marked Not Ready and stops receiving traffic, as shown in step 4 where the probe fails and traffic is stopped.
Does the pod stay not ready forever after a failure?
No, the probe runs periodically and if it succeeds later (step 6), the pod becomes ready again and traffic resumes.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the pod readiness state after the first successful probe?
ANot Ready
BReady
CUnknown
DTerminated
💡 Hint
Check Step 2 in the execution_table where the probe result is Success.
At which step does the pod stop receiving traffic?
AStep 4
BStep 6
CStep 2
DStep 1
💡 Hint
Look at the Effect column in the execution_table for when traffic is stopped.
If the initialDelaySeconds was set to 0, what would change in the execution_table?
APod would skip readiness checks
BPod would never become ready
CProbe would run immediately at Step 1
DPod would be ready before starting
💡 Hint
Refer to Step 1 where currently no probe runs due to initial delay.
Concept Snapshot
Readiness probe checks if a container is ready to serve traffic.
It runs periodically after an initial delay.
If probe succeeds, pod is marked Ready and receives traffic.
If probe fails, pod is Not Ready and traffic stops.
Common probe types: HTTP GET, TCP socket, command execution.
Configured in pod spec under readinessProbe.
Full Transcript
A readiness probe in Kubernetes is a check that tells if a container inside a pod is ready to accept traffic. When a pod starts, Kubernetes waits for a configured initial delay before running the probe. The probe sends a request, like an HTTP GET, to the container. If the container responds successfully, the pod is marked ready and traffic is sent to it. If the probe fails, the pod is marked not ready and traffic is stopped. The probe runs repeatedly at set intervals to update the pod's readiness state. This helps Kubernetes only send traffic to pods that are fully ready to handle it.