<@ULVA73B9P> any guides on how to setup self-hoste...
# ask-marvin
t
@Marvin any guides on how to setup self-hosted prefect with a k8s workpool?
m
thought for 103.3 seconds
Yep — there are a few good guides for this. Best starting points: - Scale self-hosted Prefect - Self-host Prefect Server with Helm - Run flows on Kubernetes - Work pools - Workers - Configure network access High-level setup flow for self-hosted Prefect 3.x + Kubernetes work pool: 1. Run Prefect server - Usually easiest with the Helm chart - For production, use *Postgres*; if you scale API/services horizontally, also use Redis 2. Make the API reachable from your cluster - If server is inside the same cluster, use the cluster service DNS, e.g.
<http://prefect-server.prefect.svc.cluster.local:4200/api>
- If server is outside the cluster, expose it via ingress / internal LB / routable hostname 3. Create a Kubernetes work pool - This tells Prefect that runs from that pool should launch as Kubernetes jobs 4. Run a Kubernetes worker - The worker polls the work pool and creates K8s Jobs for scheduled flow runs 5. Deploy flows to that work pool - Either from
prefect.yaml
with
prefect deploy
- Or in Python with
flow.from_source(...).deploy(...)
A very typical architecture is:
Copy code
text
Prefect server API  <--- polled by ---  Kubernetes worker
                                         |
                                         v
                                   creates K8s Jobs
                                         |
                                         v
                                     flow runs
Main gotcha: the worker needs a cluster-valid
PREFECT_API_URL
. If your server is self-hosted on a machine outside k8s,
localhost:4200
will not work from the worker pod. For example:
Copy code
text
Good inside same cluster:
<http://prefect-server.prefect.svc.cluster.local:4200/api>

Bad from inside worker pod:
<http://localhost:4200/api>
If you want the shortest path, I’d recommend: - Deploy Prefect server with Helm: server Helm guide - Then follow the Kubernetes work pool guide: run flows on Kubernetes If helpful, I can also give you a concrete end-to-end example for either of these setups: 1. Prefect server runs inside the same k8s cluster, or 2. Prefect server runs outside k8s and workers run in the cluster If you tell me which one you’re aiming for, I can sketch the exact YAML / commands.
n