CrashLoop and ImagePull

Diagnosing CrashLoopBackOff and ImagePullBackOff

Both are back-offs: the kubelet retries after a delay that doubles from 10 seconds to 5 minutes, so the status alternates between the error itself (Error, ErrImagePull) and CrashLoopBackOff or ImagePullBackOff. Reproduce both with an API that has no database settings and a tag that does not exist:

A crash loop and a failed pull, side by sideShell
kubectl create deployment crash --image=localhost:33500/booknest-api:1.4 >/dev/null 2>&1
kubectl create deployment nopull --image=localhost:33500/booknest-api:9.9 >/dev/null 2>&1
sleep 60; kubectl get pods -l 'app in (crash,nopull)'
kubectl logs deployment/crash | grep -m1 -o 'Failed.*'
kubectl events --for=pod/$(kubectl get pod -l app=nopull -o name | cut -d/ -f2) \
  | grep -m1 -o 'desc = .*' | fold -s -w 95
kubectl delete deployment crash nopull >/dev/null
Output
NAME                      READY   STATUS         RESTARTS      AGE
crash-6f5cf9d859-n5c5g    0/1     Error          3 (40s ago)   61s
nopull-6fdcc79575-wc2dr   0/1     ErrImagePull   0             60s
Failed to start BookNest API AggregateError [ECONNREFUSED]:
desc = failed to pull and unpack image "localhost:33500/booknest-api:9.9": failed to resolve
reference "localhost:33500/booknest-api:9.9": localhost:33500/booknest-api:9.9: not found
Common container failures and where their cause shows up
Status Usual cause First look
CrashLoopBackOff The process keeps exiting logs (--previous once restarted)
OOMKilled (last state) Memory limit exceeded describe, Probes and Resources
ImagePullBackOff Wrong name or tag, no credentials Events: the registry's reply

Only the log showed the API, lacking PGHOST, trying PostgreSQL 1,289 on localhost; only the events carried the registry's "not found".