https://prefect.io logo
m

Mikael Nida

07/11/2023, 7:23 PM
Hi I'm just getting started with Prefect and have some basic questions. Do I have to setup deployments "locally" or in my cloud infra? I need to access the envs for the flow I want to deploy in prefect but not quite sure how to do this deployment.
1
c

Christopher Boyd

07/11/2023, 7:52 PM
Hi Mikael - you set up prefect workers in the infrastructure / execution environment where the flows will run. You register deployments and each deployment you specify a work-pool - the work-pool is tied to the worker you set up, to determine how flow runs are picked up
Deployments are saved / registered to your prefect server / prefect cloud, execution happens wherever your workers are running
So you can have a worker running locally with the work-pool named
local_worker
- then deployments registered to the
local_worker
work pool will be executed by your local worker. You could have another worker running in kubernetes with a work-pool named
kubernetes-remote
- then deployments registered to that
kubernetes-remote
will be picked up by submission by the kubernetes worker and not the local one.
It’s probably best to start with just a local worker first to test out the mechanism - you can check out a helpful start guide here https://docs.prefect.io/latest/tutorial/deployments/#deploying-flows
m

Mikael Nida

07/11/2023, 7:55 PM
This is helpful!
So for a prod deployment, I would ssh into my k8s and have to prefect login on there and then create a deployment again
c

Christopher Boyd

07/11/2023, 7:57 PM
no
your k8s would just run a prefect-worker that you installed from the helm chart which stays listening on a specific work-pool
👀 1
you’d just run prefect-deploy locally to register a deployment, the work-pool you specify in the prefect deploy dictates where the flow-run gets picked up
m

Mikael Nida

07/11/2023, 7:59 PM
Ahh got it. Thank you, I'll message here when I run into anything weird!
c

Christopher Boyd

07/11/2023, 8:00 PM
basically: a) Deploy a k8s worker from here - you can use the default or specify a new work-pool name b) run prefect deploy for your flow - specify the work-pool from your k8s worker
1