Kubernetes startupProbe Configuration Guide
Configure startupProbe for slow-starting containers to prevent premature kills. Understand interaction with liveness and readiness probes.
π‘ Quick Answer:
startupProbedisables liveness/readiness checks until the container is fully initialized. SetfailureThreshold Γ periodSecondsto cover your appβs maximum startup time.
The Problem
Java apps, ML models, and legacy services can take 60-300 seconds to start. Without a startupProbe:
- Liveness probe kills the container before itβs ready β CrashLoopBackOff
- Setting high
initialDelaySecondson liveness is fragile and slows restart detection
The Solution
Basic startupProbe
apiVersion: v1
kind: Pod
metadata:
name: java-app
spec:
containers:
- name: app
image: spring-boot-app:3.0
ports:
- containerPort: 8080
startupProbe:
httpGet:
path: /actuator/health/started
port: 8080
failureThreshold: 30
periodSeconds: 10
# Total startup budget: 30 Γ 10 = 300 seconds
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
periodSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
periodSeconds: 5
failureThreshold: 3TCP startupProbe (databases)
startupProbe:
tcpSocket:
port: 5432
failureThreshold: 30
periodSeconds: 5
# Budget: 150 seconds for DB initializationExec startupProbe (custom check)
startupProbe:
exec:
command:
- /bin/sh
- -c
- "test -f /app/ready.flag"
failureThreshold: 60
periodSeconds: 5
# Budget: 300 seconds for model loadingsequenceDiagram
participant K as Kubelet
participant C as Container
K->>C: Start container
Note over K: startupProbe active<br/>liveness/readiness DISABLED
loop Every periodSeconds
K->>C: startupProbe check
C-->>K: Failure (still starting)
end
K->>C: startupProbe check
C-->>K: Success β
Note over K: startupProbe done<br/>liveness + readiness ENABLED
loop Ongoing
K->>C: livenessProbe check
K->>C: readinessProbe check
endCommon Issues
Container killed during startup Increase failureThreshold:
startupProbe:
failureThreshold: 60 # 60 Γ 10s = 10 minutes
periodSeconds: 10startupProbe succeeds but app not fully ready Use separate endpoints: startup = βprocess is aliveβ, readiness = βcan serve trafficβ:
startupProbe:
httpGet:
path: /started # Returns 200 once JVM is up
readinessProbe:
httpGet:
path: /ready # Returns 200 once connections are warmedProbe timeout too short Default timeoutSeconds is 1. Slow health endpoints need more:
startupProbe:
httpGet:
path: /health
port: 8080
timeoutSeconds: 5Best Practices
- Set startup budget = max observed startup time Γ 1.5
- Use HTTP probes when possible (more informative than TCP)
- Liveness probe should NEVER check external dependencies (causes cascading restarts)
- Readiness probe CAN check dependencies (removes from Service endpoints)
- Keep
periodSecondslow (5-10s) for faster startup detection - Use separate health endpoints:
/started,/live,/ready
Key Takeaways
- startupProbe runs first β liveness and readiness are paused until it succeeds
- Max startup time =
failureThreshold Γ periodSeconds - After startupProbe succeeds, it never runs again for that container
- If startupProbe exhausts retries, container is killed (like liveness failure)
- Replaces the anti-pattern of high
initialDelaySecondson liveness - Available since Kubernetes 1.20 (GA)

Recommended
Kubernetes Recipes β The Complete Book100+ production-ready patterns with detailed explanations, best practices, and copy-paste YAML. Everything in one place.
Get the Book βLearn by Doing
CopyPasteLearn β Hands-on Cloud & DevOps CoursesMaster Kubernetes, Ansible, Terraform, and MLOps with interactive, copy-paste-run lessons. Start free.
Browse Courses βπ Deepen Your Skills β Hands-on Courses
Courses by CopyPasteLearn.com β Learn IT by Doing
