ExitCode 128
KubernetesERRORCriticalContainer ErrorHIGH confidence

Invalid exit argument passed to exit()

Production Risk

Repeated exits cause CrashLoopBackOff; service is degraded.

What this means

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.

Why it happens
  1. 1Shell script called exit with a non-integer or out-of-range value
  2. 2Application exited via exit(128) explicitly to signal a fatal config error
  3. 3Base code for signal termination: 128 + signal number (e.g., 128+9=137 for SIGKILL)
How to reproduce

Container exits with code 128; usually a scripting defect in the entrypoint.

trigger — this will error
trigger — this will error
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

Audit shell script exit calls
# 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-integer

Why this works

Ensures exit codes in scripts are valid integers within 0–255.

Sources
Official documentation ↗

Kubernetes Documentation

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Kubernetes errors