<@ULVA73B9P> the ecs worker is using the ecs:start...
# ask-marvin
m
@Marvin the ecs worker is using the ecs:startTask command to start a new deployment, what does the K8 worker use to trigger an ecs task as a pod
m
thought for 168.8 seconds
The K8s worker does not call an ECS-style “start task” equivalent. In Prefect 3.x, the Kubernetes worker creates a Kubernetes
Job
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:
Copy code
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