What if your app could fix itself before you even notice a problem?
Why probes keep applications healthy in Kubernetes - The Real Reasons
Imagine you run a busy restaurant kitchen where chefs prepare meals. If a chef suddenly feels unwell or makes a mistake, you want to know quickly to fix the problem or replace them. Without a way to check, bad meals pile up and customers get unhappy.
Manually checking if each chef is doing well is slow and unreliable. You might miss signs of trouble, causing delays and unhappy customers. Similarly, without automatic checks, applications can silently fail or freeze, leading to downtime and lost users.
Probes act like kitchen managers who constantly check if chefs are healthy and working properly. They automatically detect problems early and help restart or fix the application before users notice any issue, keeping everything running smoothly.
No automatic checks; rely on manual monitoring and guessworklivenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10Probes enable applications to self-heal by detecting and fixing problems automatically, ensuring continuous availability.
In a web store, probes detect if the payment service freezes and restart it immediately, so customers can always complete their purchases without errors.
Manual health checks are slow and error-prone.
Probes automatically monitor and fix application health.
This keeps apps running smoothly and users happy.
Practice
Solution
Step 1: Understand liveness probe role
Liveness probes check if the app is alive and working properly.Step 2: Identify action on failure
If the liveness probe fails, Kubernetes restarts the app to fix it.Final Answer:
To check if the application is running and restart it if it is not healthy -> Option AQuick Check:
Liveness probe = restarts unhealthy app [OK]
- Confusing liveness with readiness probe
- Thinking liveness controls traffic
- Assuming liveness updates configs
Solution
Step 1: Identify readiness probe syntax
Readiness probes often use httpGet with path and port defined.Step 2: Match correct YAML structure
readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 5 periodSeconds: 10 shows readinessProbe with httpGet, initialDelaySeconds, and periodSeconds correctly.Final Answer:
readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 5 periodSeconds: 10 -> Option AQuick Check:
Readiness probe syntax = readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 5 periodSeconds: 10 [OK]
- Mixing liveness and readiness probe syntax
- Using startupProbe instead of readinessProbe
- Incorrect indentation or missing fields
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10Solution
Step 1: Understand readiness probe effect
Readiness probe controls if pod is ready to get user traffic.Step 2: Identify behavior on failure
If readiness probe fails, pod stays running but is removed from service endpoints, so no new traffic.Final Answer:
The pod stops receiving new traffic but keeps running -> Option BQuick Check:
Readiness failure = no traffic, pod runs [OK]
- Thinking readiness failure restarts pod
- Confusing readiness with liveness probe
- Assuming pod deletion on readiness failure
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
What is the most likely cause?Solution
Step 1: Analyze liveness probe behavior
Liveness probe checks /health on port 8080 every 10 seconds after 5 seconds delay.Step 2: Understand restart cause
If app does not respond correctly 3 times (failureThreshold), Kubernetes restarts pod.Final Answer:
The application is not responding to the /health endpoint in time -> Option DQuick Check:
Liveness failure = app not responding, causes restart [OK]
- Assuming readiness probe causes restart
- Ignoring failureThreshold effect
- Blaming resource limits without evidence
Solution
Step 1: Identify probe controlling traffic
Readiness probe controls when app receives user traffic.Step 2: Choose probe matching app readiness
Readiness probe checking /ready after data load ensures traffic only after app is ready.Step 3: Exclude other options
Liveness restarts app but does not control traffic; startup probe delays startup but not traffic control.Final Answer:
Use a readiness probe that checks a /ready endpoint returning success after data load -> Option CQuick Check:
Readiness probe controls traffic flow [OK]
- Using liveness probe to control traffic
- Confusing startup probe with readiness probe
- Checking same endpoint for both probes
Ready to prove it?
Pass the test and this pattern moves unknown
