Probe Timing Parameters
What you'll learn: How to fine-tune Kubernetes probe behavior using timing parameters to ensure reliable health checks without overwhelming your applications.
Why Timing Matters
You've already learned to define liveness, readiness, and startup probes. Now it's time to control when and how often they run. Without proper timing, probes might kill healthy containers during startup or miss actual failures by checking too infrequently.
The Four Critical Parameters
initialDelaySeconds
How long Kubernetes waits after the container starts before running the first probe. Use this for containers that need time to initialize before they're healthy.
Analogy: Like waiting 5 minutes after someone wakes up before asking if they're ready for work.
periodSeconds
The interval between probe checks. Defaults to 10 seconds. More frequent checks catch failures faster but consume more resources.
Analogy: Checking your email every 5 minutes versus every hour.
timeoutSeconds
How long to wait for a probe response before considering it failed. Defaults to 1 second. Set higher for slow endpoints.
Analogy: How long you'll hold on the phone before hanging up.
failureThreshold
How many consecutive failures before taking action (marking unhealthy or restarting). Defaults to 3. Higher values tolerate transient issues better.
Analogy: Getting three strikes before you're out.
Choosing Values Wisely
- Slow-starting apps: Use
initialDelaySeconds: 30or higher, or prefer startup probes - Critical services: Lower
periodSeconds: 5for faster failure detection - Network latency: Increase
timeoutSeconds: 3for remote checks - Transient failures: Set
failureThreshold: 5to avoid false positives during brief hiccups
Key Takeaway: Properly configured probe timing parameters prevent premature restarts and ensure responsive failure detection—balance between quick detection and stability tolerance based on your application's behavior.