Denys Y
09/11/2025, 1:16 PMMarvin
09/11/2025, 1:16 PMMarvin
09/11/2025, 1:19 PMkubectl -n <ns> describe job misty-galago-jmj4x
kubectl -n <ns> get events --field-selector involvedObject.kind=Job,involvedObject.name=misty-galago-jmj4x --sort-by=.lastTimestamp
Look for:
- FailedScheduling, ImagePullBackOff, ErrImagePull
- DeadlineExceeded, OOMKilled (memory), permission errors, command not found
2) List all pods that were created for this Job
kubectl -n <ns> get pods -l job-name=misty-galago-jmj4x -o wide
There may be several (each retry creates a new pod). Pick the newest failed pod for deep inspection.
3) Check pod details and container termination status
kubectl -n <ns> describe pod <pod-name>
# Quick view of exit reasons and codes
kubectl -n <ns> get pod <pod-name> -o jsonpath='{range .status.containerStatuses[*]}{.name} {.state.terminated.reason} exit={.state.terminated.exitCode} last={.lastState.terminated.reason}{"\n"}{end}'
Common signals:
- OOMKilled or exit 137 → memory limit too low
- CrashLoopBackOff / ContainerCannotRun → bad entrypoint/command, permissions, or image arch mismatch
- ImagePullBackOff / ErrImagePull → bad image tag or missing registry secret
- FailedScheduling → not enough resources or node constraints
4) Get container logs (this is where Python exceptions or Prefect startup issues show)
# All containers in the pod
kubectl -n <ns> logs <pod-name> --all-containers --timestamps
# If a container restarted and you need the prior attempt
kubectl -n <ns> logs <pod-name> --all-containers --previous
If the pod never started (e.g., image pull error), logs will be empty—rely on describe/events in that case.
5) Check the command/args used by the pod (bad commands fail immediately)
kubectl -n <ns> get pod <pod-name> -o jsonpath='{.spec.containers[0].command}{" "}{.spec.containers[0].args}'
6) Optional: Observer logs (context around the “marking as crashed”)
kubectl -n <ns> get pods | grep observer
kubectl -n <ns> logs <observer-pod-name>
This confirms the observer’s decision but won’t show application errors inside your pod.
Common fixes by symptom
- OOMKilled: increase container memory request/limit in your Prefect Kubernetes work pool/job template; reduce data loaded in memory; chunk work.
- ImagePullBackOff: verify image name/tag and imagePullSecrets; ensure the secret is in the same namespace.
- CrashLoopBackOff / ContainerCannotRun: validate base image, entrypoint, file permissions, and that Python/env deps exist. If using a custom image, confirm Prefect is installed and the flow code is reachable.
- FailedScheduling: adjust requests/limits, node selectors, tolerations, or quotas so the pod can land.
- Network/API issues: if logs show connection issues to the Prefect API, ensure outbound egress and that PREFECT_API_URL and credentials are set.
Where to look in Prefect
- If the container started the Prefect engine, you’ll also see error logs on the Flow Run page in the UI. If the job failed before Prefect started (e.g., image pull or command error), the UI will have little/no logs—Kubernetes logs are authoritative.
Docs
- Prefect 3.x Kubernetes deployment guide: Prefect Kubernetes guideMarvin
09/11/2025, 1:19 PMkubectl -n <ns> describe job misty-galago-jmj4x
- kubectl -n <ns> describe pod <one-failed-pod>
- The last 100 lines of kubectl -n <ns> logs <that-pod> --all-containers
…I can help pinpoint the exact cause and the right fix. Do you know which namespace this job ran in?Denys Y
09/11/2025, 1:43 PMMarvin
09/11/2025, 1:43 PMresearch_prefect_topic
📊 Tools used:
• research_prefect_topic (1x)