An exit code is the numeric result a process returns when it terminates. In container health checks, exit code 0 means the command succeeded; a non-zero code indicates failure. section 6.2.5
Exit codes also help distinguish how a container stopped. Code 0 indicates graceful self-termination, while code 137 means the process was killed. More generally, code 128+n indicates termination by external signal n; code 143 represents SIGTERM. section 6.2.4
Inspecting a restarted container
After a failed liveness probe causes a restart, kubectl describe pod can show the previous container's exit code. kubectl logs -p can then reveal whether the process caught SIGTERM and shut down gracefully. section 6.2.4
livenessProbe:
exec:
command: #1
- /usr/bin/healthcheck #1
periodSeconds: 2 #2
timeoutSeconds: 1 #3
failureThreshold: 1 #4
An exec liveness probe runs /usr/bin/healthcheck inside the container and treats exit code 0 as healthy; non-zero results trigger the configured failure behavior. section 6.2.5

