ExitCode 1
KubernetesERRORNotableContainer ErrorHIGH confidence

Application exited with a general error

Production Risk

CrashLoopBackOff due to repeated exit code 1 will prevent the deployment from serving traffic.

What this means

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.

Why it happens
  1. 1Unhandled exception or panic in application code
  2. 2Missing required environment variable or configuration file
  3. 3Failed database connection or downstream dependency at startup
  4. 4Explicit os.Exit(1) / sys.exit(1) call in application code
How to reproduce

Pod enters CrashLoopBackOff or Error state with exit code 1 visible in kubectl describe.

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

Inspect previous container logs
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

Check environment variables and secrets
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.

Sources
Official documentation ↗

Kubernetes Documentation

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

← All Kubernetes errors