0
0
Kubernetesdevops~10 mins

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

Choose your learning style9 modes available
Process Flow - Startup probe concept
Pod starts
Startup probe runs
Probe success?
NoRetry after delay
Failure threshold reached?
NoRetry
Container marked started
Readiness & Liveness probes start
The startup probe runs repeatedly after pod start until it succeeds or fails too many times. Success means container is ready to run readiness and liveness probes. Failure triggers pod restart.
Execution Sample
Kubernetes
startupProbe:
  exec:
    command: ["cat", "/tmp/healthy"]
  failureThreshold: 3
  periodSeconds: 5
This startup probe runs a command every 5 seconds, retries up to 3 times before failing.
Process Table
AttemptTime (s)Command ResultProbe StatusAction
10File not foundFailureRetry after 5s
25File not foundFailureRetry after 5s
310File not foundFailureFailure threshold reached, pod restart
415Pod restartsN/AStartup probe restarts
💡 Failure threshold 3 reached at 10s, pod restarts and startup probe restarts
Status Tracker
VariableStartAfter Attempt 1After Attempt 2After Attempt 3After Restart
failureCount01230
probeStatusN/AFailureFailureFailureN/A
podStateStartingStartingStartingRestartingStarting
Key Moments - 3 Insights
Why does the pod restart after 3 failed attempts?
Because failureThreshold is 3, after 3 consecutive failures (see execution_table rows 1-3), Kubernetes restarts the pod to try again.
When do readiness and liveness probes start running?
They start only after the startup probe succeeds, which means the container is fully started (not shown in this failure example).
What happens to failureCount after pod restart?
It resets to 0 because the pod and its probes start fresh (see variable_tracker After Restart).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the failureCount after the second attempt?
A3
B1
C2
D0
💡 Hint
Check variable_tracker row for failureCount after Attempt 2
At which attempt does the pod restart happen?
AAfter Attempt 3
BAfter Attempt 1
CAfter Attempt 2
DAfter Attempt 4
💡 Hint
See execution_table Action column for when failure threshold triggers restart
If the failureThreshold was set to 5, what would change in the execution table?
APod would restart after 3 failures
BPod would restart after 5 failures
CPod would never restart
DPod would restart immediately
💡 Hint
failureThreshold controls max failures before restart, see execution_table rows and exit_note
Concept Snapshot
Startup probe runs after pod starts to check if container is ready.
It retries command or check every periodSeconds.
If failures reach failureThreshold, pod restarts.
Success means readiness and liveness probes start.
Useful for slow-starting containers.
Full Transcript
The startup probe in Kubernetes runs repeatedly after a pod starts to check if the container is ready. It executes a command or HTTP check every periodSeconds. If the probe fails, it retries until failureThreshold is reached. If failures reach this threshold, Kubernetes restarts the pod to try again. Once the startup probe succeeds, readiness and liveness probes begin to monitor the container's health. This mechanism helps with containers that take longer to start, preventing premature restarts.