Markella Skempri
04/23/2026, 11:34 AMMarvin
04/23/2026, 11:34 AMMarvin
04/23/2026, 11:37 AMJob resource using the Kubernetes API, and that Job then creates/manages the Pod for the flow run.
So the rough mapping is:
- ECS worker → calls ECS API like run_task / startTask
- Kubernetes worker → calls Kubernetes Batch API to create_namespaced_job(...)
Under the hood, the Kubernetes worker uses the Kubernetes Python client’s BatchV1Api and creates a resource like:
yaml
apiVersion: batch/v1
kind: Job
...
Then Kubernetes itself schedules the Pod from the Job’s pod template.
A few useful details:
- Trigger resource: Job
- API group/version: batch/v1
- Primary create call: BatchV1Api.create_namespaced_job(...)
- Logs/status: fetched from the resulting Pod(s) via the Core API
So if you’re asking “what is the K8s equivalent of starting an ECS task?”, the answer is:
The Prefect Kubernetes worker creates a Kubernetes Job, which in turn launches a Pod.
If helpful, I can also show:
- the exact Prefect worker code path for this
- how this differs from the Kubernetes worker vs KubernetesJob block/infrastructure
- what manifest fields Prefect sends by default