Invalid exit argument passed to exit()
Production Risk
Repeated exits cause CrashLoopBackOff; service is degraded.
Exit code 128 indicates that a process called exit() with an invalid argument (exit codes must be integers in the range 0–255). In practice, exit code 128 is also used as a base for signal-terminated processes; for example, exit code 128+N means the process was killed by signal N. Standalone code 128 usually indicates a scripting error.
- 1Shell script called exit with a non-integer or out-of-range value
- 2Application exited via exit(128) explicitly to signal a fatal config error
- 3Base code for signal termination: 128 + signal number (e.g., 128+9=137 for SIGKILL)
Container exits with code 128; usually a scripting defect in the entrypoint.
kubectl describe pod mypod # Last State: Terminated Reason: Error Exit Code: 128 kubectl logs mypod --previous
expected output
Last State: Terminated Reason: Error Exit Code: 128
Fix
Audit shell script exit calls
WHEN Entrypoint is a shell script
# Review the script for invalid exit calls
kubectl exec mypod -- cat /app/entrypoint.sh
# Look for: exit ${variable} where variable may be empty or non-integerWhy this works
Ensures exit codes in scripts are valid integers within 0–255.
Kubernetes Documentation
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev