Charlie Nash
07/10/2025, 2:44 PMMarvin
07/10/2025, 2:44 PMMarvin
07/10/2025, 2:44 PMbash
helm repo add prefect <https://prefecthq.github.io/prefect-helm>
helm repo update
2. Create a Kubernetes secret for your Prefect API key:
bash
kubectl create secret generic prefect-api-key \
--namespace=prefect \
--from-literal=key=your-prefect-cloud-api-key
3. Create a values.yaml
file to configure your worker. Here's a basic example:
yaml
worker:
apiKey:
secretName: prefect-api-key
secretKey: key
workPool: your-work-pool-name
4. Install the worker using Helm:
bash
helm install prefect-worker prefect/prefect-worker \
--namespace prefect \
-f values.yaml
Additional Configuration Tips:
- If you're running on a serverless cluster (like EKS), you might want to increase the pod watch timeout to avoid issues with long startup times. Add this to your `values.yaml`:
yaml
worker:
podWatchTimeoutSeconds: 300
- You can specify resource requests and limits in your `values.yaml`:
yaml
worker:
resources:
requests:
cpu: "500m"
memory: "512Mi"
limits:
cpu: "1000m"
memory: "1Gi"
The worker will automatically poll for scheduled runs and execute them within your Kubernetes cluster. It handles the creation and management of pods for your flow runs.
For more detailed information, you can refer to:
- The official Kubernetes deployment guide: https://docs-3.prefect.io/v3/how-to-guides/deployment_infra/kubernetes
- Example configurations: https://github.com/zzstoatzz/prefect-pack/tree/main/examples/run_a_prefect_worker/on_k8s/README.md
Let me know if you need help with any specific configuration or if you run into any issues!