0
0
Kubernetesdevops~10 mins

Why probes keep applications healthy in Kubernetes - Visual Breakdown

Choose your learning style9 modes available
Process Flow - Why probes keep applications healthy
Start Application Pod
Kubelet runs Probes
Perform Liveness Probe
Is Pod Alive?
NoRestart Pod
Yes
Perform Readiness Probe
Is Pod Ready?
NoRemove Pod from Service
Yes
Pod serves traffic
Repeat Probes Periodically
Kubernetes uses probes to check if an application is alive and ready. If not alive, it restarts the pod. If not ready, it stops sending traffic to it.
Execution Sample
Kubernetes
livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10
This liveness probe checks the /healthz endpoint every 10 seconds after waiting 5 seconds initially.
Process Table
StepProbe TypeProbe ActionProbe ResultKubelet ActionPod State
1LivenessCheck /healthzSuccessNo actionRunning
2ReadinessCheck /readySuccessPod in serviceServing traffic
3LivenessCheck /healthzFailureRestart PodRestarting
4LivenessCheck /healthzSuccessNo actionRunning
5ReadinessCheck /readyFailureRemove from serviceNot serving traffic
6ReadinessCheck /readySuccessAdd to serviceServing traffic
7LivenessCheck /healthzSuccessNo actionRunning
💡 Probes run continuously to keep pod healthy and traffic routed correctly.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5After Step 6After Step 7
Pod StateStartingRunningServing trafficRestartingRunningNot serving trafficServing trafficRunning
Traffic RoutingNoneRoutedRoutedNoneNoneNoneRoutedRouted
Key Moments - 3 Insights
Why does the pod restart after a liveness probe failure?
Because the liveness probe failure means the pod is unhealthy and cannot recover, so Kubernetes restarts it to restore health (see execution_table step 3).
Why is traffic removed from the pod after a readiness probe failure?
Readiness probe failure means the pod is not ready to serve requests, so Kubernetes stops sending traffic to avoid errors (see execution_table step 5).
Can a pod be running but not serving traffic?
Yes, if the readiness probe fails but liveness probe passes, the pod runs but is removed from service (see execution_table step 5).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what action does Kubernetes take at step 3 when the liveness probe fails?
ARestart the pod
BRemove pod from service
CDo nothing
DSend traffic to pod
💡 Hint
Check the 'Kubelet Action' column at step 3 in the execution_table.
At which step does the pod stop serving traffic due to readiness probe failure?
AStep 2
BStep 4
CStep 5
DStep 7
💡 Hint
Look at the 'Pod State' and 'Kubelet Action' columns for readiness probe failures.
If the readiness probe always succeeds, how would the traffic routing change in the variable_tracker?
ATraffic would never be routed
BTraffic would always be routed to the pod
CTraffic would be removed intermittently
DPod would restart frequently
💡 Hint
Check the 'Traffic Routing' row in variable_tracker and relate it to readiness probe results.
Concept Snapshot
Kubernetes probes check pod health:
- Liveness probe: restarts pod if unhealthy
- Readiness probe: controls traffic routing
- Probes run periodically
- Keeps apps healthy and responsive
Full Transcript
Kubernetes uses liveness and readiness probes to keep applications healthy. The liveness probe checks if the pod is alive; if it fails, Kubernetes restarts the pod to fix issues. The readiness probe checks if the pod is ready to serve traffic; if it fails, Kubernetes stops sending traffic to avoid errors. These probes run repeatedly to monitor pod health and traffic routing. This process ensures applications stay healthy and responsive.