Application exited with a general error
Production Risk
CrashLoopBackOff due to repeated exit code 1 will prevent the deployment from serving traffic.
Exit code 1 is the most common non-zero exit code and indicates a general application-level error. The container process itself ran but encountered a fatal condition and called exit(1) or equivalent. The root cause lives entirely within the application logic or its configuration.
- 1Unhandled exception or panic in application code
- 2Missing required environment variable or configuration file
- 3Failed database connection or downstream dependency at startup
- 4Explicit os.Exit(1) / sys.exit(1) call in application code
Pod enters CrashLoopBackOff or Error state with exit code 1 visible in kubectl describe.
kubectl describe pod mypod # Last State: Terminated Reason: Error Exit Code: 1 kubectl logs mypod --previous
expected output
Last State: Terminated Reason: Error Exit Code: 1 Started: ... Finished: ...
Fix 1
Inspect previous container logs
WHEN Always the first step — the application will have logged the reason
kubectl logs mypod --previous kubectl logs mypod --previous --tail=100
Why this works
The previous-container logs capture stdout/stderr from the crashed container before Kubernetes restarted it.
Fix 2
Check environment variables and secrets
WHEN Application logs indicate missing config
kubectl exec mypod -- env | sort kubectl describe pod mypod | grep -A 20 "Environment:"
Why this works
Confirms that all required environment variables are injected and secrets are mounted correctly.
Kubernetes Documentation
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev