Health Probes and Resources
Keep traffic off bad pods and size containers. Results appear in the same fence: same-line # comments when short, multiline # blocks below the sample when not. Fences are bash, dockerfile, or yaml as appropriate.
Controls Service Endpoints membership.
readinessProbe :
httpGet : { path : /ready , port : 8080 }
periodSeconds : 5
# not ready => removed from Service
Restart container when stuck.
livenessProbe :
httpGet : { path : /healthz , port : 8080 }
failureThreshold : 3
# kubelet restarts after failures
Delay other probes during slow start.
startupProbe :
httpGet : { path : /healthz , port : 8080 }
failureThreshold : 30
periodSeconds : 5
# up to ~150s startup
CPU/memory requests and limits.
resources :
requests : { cpu : "100m" , memory : "128Mi" }
limits : { cpu : "500m" , memory : "256Mi" }
# scheduler uses requests; limit caps usage
Guaranteed when requests==limits for all.
# requests=limits for cpu+memory => Guaranteed QoS
# else Burstable or BestEffort
Port-open probe without HTTP.
readinessProbe :
tcpSocket : { port : 5432 }
# succeeds if TCP connect works
Run a command in the container.
livenessProbe :
exec : { command : [ "pg_isready" , "-U" , "postgres" ] }
# exit 0 = healthy
Legacy delay before probes (prefer startupProbe).
livenessProbe :
initialDelaySeconds : 20
httpGet : { path : /healthz , port : 8080 }
# waits 20s before first probe
Probe timeout.
readinessProbe :
timeoutSeconds : 2
httpGet : { path : /ready , port : 8080 }
# fail if slower than 2s
Consecutive failures to mark failed.
failureThreshold : 3
# 3 fails => not ready / restart
Successes required after failure (readiness).
successThreshold : 1
# one success returns to ready
Request disk for emptyDir logs/cache.
resources :
requests : { ephemeral-storage : "1Gi" }
limits : { ephemeral-storage : "2Gi" }
# eviction if over limit
Special memory resource (when enabled).
resources :
requests : { hugepages-2Mi : "100Mi" }
# node must provide hugepages
Probe cluster-local Service, not public edge, when possible.
# readiness on /ready internal only
Exceed memory limit => OOMKilled restart.
# kubectl describe pod ... Last State: OOMKilled
Stack versions: Kubernetes 1.36.2 · Docker Engine 29.6.1 · Helm 3 · Compose v2 · containerd via CRI