Scott Pedersen
12/23/2025, 7:54 PMMarvin
12/23/2025, 7:55 PMMarvin
12/23/2025, 7:57 PMkubectl create clusterrolebinding prefect-worker-edit \
--clusterrole=edit \
--serviceaccount=<ns>:<sa>
4) Check Events in the namespace for API or quota errors:
- kubectl get events -n <namespace> --sort-by=.lastTimestamp
5) Confirm the namespace and SA configured in your work pool match what’s in the cluster.
6) If you’re using secret creation for the API key, try disabling it temporarily to rule it out.
7) Ensure the worker image includes the Kubernetes integration:
- pip install "prefect[kubernetes]"
If you can share:
- Whether you see “Creating Kubernetes job…” or “Failed to submit flow run …” after the “submitting” line
- The flow run state (Pending/Running/Crashed) and any state message
- The worker’s namespace and ServiceAccount name
- Output of kubectl get jobs -n <ns> and kubectl auth can-i create jobs --as=systemserviceaccount<ns>:<sa> -n <ns>
…I can pinpoint the root cause quickly.
Helpful references
- Kubernetes RBAC overview: RBAC docs
- Prefect docs home: Prefect 3.x docs (see the Kubernetes worker integration section)Scott Pedersen
12/23/2025, 8:06 PMWorker KubernetesWorker submitting flow run and there was nothing else after this logMarvin
12/23/2025, 8:07 PMMarvin
12/23/2025, 8:07 PMWorker KubernetesWorker submitting flow run
and nothing after, that means the worker picked up the run but never got far enough to log “Creating Kubernetes job…” or to emit an error like “Failed to submit flow run…”. In practice, this points to one of these root causes:
Most common root causes
- The worker pod restarted mid‑submission (OOMKilled/crash) so you miss subsequent logs.
- RBAC prevents creating Jobs/Secrets and the worker died/restarted before flushing the error.
- Kubernetes API/network is unreachable from the worker (network policy/DNS), causing a hard hang or crash during client setup.
- Secret creation for the API key (if enabled) failed early and the worker died.
- The worker image is missing the Kubernetes integration and crashes when initializing the client.
Targeted checks
1) Check the flow run state/message in the UI:
- If it shows Crashed with “Flow run could not be submitted…”, share the message — it usually includes the Kubernetes error (e.g., jobs.batch is forbidden).
- If it remains Pending or disappears without a crash message, the worker likely restarted.
2) Check if the worker pod restarted:
- Describe the pod and look for OOMKilled or restarts.
kubectl describe pod <worker-pod> -n <ns>
kubectl get pod <worker-pod> -n <ns> -o jsonpath='{.status.containerStatuses[*].restartCount}'
- If restarts > 0 or OOMKilled shows up, increase resources or inspect container logs prior to restart.
3) Verify RBAC for the worker ServiceAccount:
kubectl auth can-i create jobs --as=system:serviceaccount:<ns>:<sa> -n <target-namespace>
kubectl auth can-i create secrets --as=system:serviceaccount:<ns>:<sa> -n <target-namespace>
If these return “no”, grant permissions (for a quick test):
kubectl create clusterrolebinding prefect-worker-edit \
--clusterrole=edit \
--serviceaccount=<ns>:<sa>
4) Confirm namespace and work pool settings match:
- Ensure the namespace in your work pool/job template exists and is the one your SA has rights to.
5) Network reachability from worker:
- Check for NetworkPolicies that could block egress to the API server.
- From another pod in the same namespace/with same SA, verify basic API calls (or review Events).
kubectl get events -n <namespace> --sort-by=.lastTimestamp
6) Enable debug logs on the worker to capture early errors:
- Set env: PREFECT_LOGGING_LEVEL=DEBUG on the worker deployment and re-test.
7) Ensure the Kubernetes integration is present in the worker image:
- The image should include the extra: pip install "prefect[kubernetes]".
If you can share:
- The flow run’s current state and any state message
- Worker SA and namespace
- Worker pod restart count and any OOMKilled indication
- Result of the two kubectl auth can-i checks
…I can help pinpoint the exact root cause and next fix quickly.
Prefect docs home (for reference): Prefect 3.x docsScott Pedersen
12/23/2025, 8:11 PMMarvin
12/23/2025, 8:11 PMMarvin
12/23/2025, 8:15 PMprefect flow-run inspect <flow-run-id>
2) Make sure a worker is connected and healthy (logs should show normal polling and not repeated restarts).
3) Check RBAC on the worker’s ServiceAccount for your target namespace:
kubectl auth can-i delete jobs --as=system:serviceaccount:<ns>:<sa> -n <ns>
kubectl auth can-i delete pods --as=system:serviceaccount:<ns>:<sa> -n <ns>
kubectl auth can-i list pods --as=system:serviceaccount:<ns>:<sa> -n <ns>
If these return “no”, granting delete/list on jobs/pods will allow cancellation to complete.
4) Look at worker logs around the time you clicked Cancel. With DEBUG enabled (PREFECT_LOGGING_LEVEL=DEBUG), you should see it observe the Cancelling state and attempt cleanup; if it can’t find or delete the job, the error will be there.
5) Verify the namespace in your work pool/job template matches where the job would be created and where the SA has rights.
6) If you only ever saw “Worker KubernetesWorker submitting flow run” on submission, confirm whether infrastructure_pid was ever set on that run. If it’s missing but the run is in Cancelling, that’s a strong indicator the worker can’t complete cancellation.
If you can share:
- The output of prefect flow-run inspect <id> (especially state, state_details, and infrastructure_pid)
- The worker’s namespace/ServiceAccount
- Results of the kubectl auth can-i delete jobs/pods checks
…I can help pinpoint whether this is a worker connectivity issue, RBAC, or an infra_pid/scoping problem.
References
- Prefect docs: Prefect 3.x docs (see Workers and Kubernetes integration sections)Scott Pedersen
12/23/2025, 8:24 PMMarvin
12/23/2025, 8:24 PMMarvin
12/23/2025, 8:26 PMprefect work-pool ls
- Inspect a work pool (includes its queues and settings)
prefect work-pool inspect <pool-name>
- Preview all scheduled work across all queues in a pool
prefect work-pool preview <pool-name> --hours 24
- List work queues
prefect work-queue ls
- Inspect a specific queue
prefect work-queue inspect <queue-name> --pool <pool-name>
- Preview scheduled work for a queue
prefect work-queue preview <queue-name> --pool <pool-name> --hours 24
- Read runs currently in a queue (artificial poll)
prefect work-queue read-runs <queue-name> --pool <pool-name>
Note: this triggers an artificial poll of the queue on the server. It’s safe and does not submit the runs, but it will update poll metadata; avoid spamming it in production.
UI options
- Work Pools page → click your pool → Queues tab: see all queues, their status/concurrency, and preview upcoming scheduled work.
- Runs page: filter by Work Pool and Work Queue to see the runs routed to a specific queue.
If you share your pool/queue names, I can give exact command examples.Scott Pedersen
12/25/2025, 12:43 AMMarvin
12/25/2025, 12:43 AMMarvin
12/25/2025, 12:46 AMBring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by