Fugo Takefusa
09/26/2025, 3:13 AMMarvin
09/26/2025, 3:14 AMMarvin
09/26/2025, 3:22 AMdeployments:
- name: my-process-deployment
entrypoint: flows/flow.py:my_flow
work_pool:
name: my-process-pool
job_variables:
env:
LOG_LEVEL: INFO
FEATURE_FLAG_X: "true"
Docker work pool
deployments:
- name: my-docker-deployment
entrypoint: flows/flow.py:my_flow
work_pool:
name: my-docker-pool
job_variables:
image: myrepo/myimage:latest
env:
ENVIRONMENT: prod
API_BASE_URL: <https://api.example.com>
Kubernetes work pool
- You can set simple key/value env vars via job_variables.env.
- If you need valueFrom (e.g., secretKeyRef), add it in job_variables.job_manifest.
deployments:
- name: my-k8s-deployment
entrypoint: flows/flow.py:my_flow
work_pool:
name: my-k8s-pool
job_variables:
image: myrepo/myimage:latest
namespace: default
service_account_name: my-service-account
env:
SIMPLE_VAR: hello
job_manifest:
spec:
template:
spec:
containers:
- name: prefect-job
env:
- name: SECRET_FROM_K8S
valueFrom:
secretKeyRef:
name: my-secret
key: password
Notes and tips
- No automatic ${ENV_VAR} expansion: prefect.yaml does not automatically expand shell-style env variables in-place. Put literal strings in env or ensure the worker’s runtime environment already has the variables set.
- Work pool defaults vs deployment overrides: You can set default env at the work-pool level (in the UI or via the base job template). Values in a deployment’s job_variables will override/extend those defaults.
- Kubernetes merging: job_variables.env is rendered into the pod’s container env list. If you also specify env entries in job_manifest, those are merged; explicit entries in the manifest take precedence on conflicts.
Docs
- Prefect YAML overview: prefect.yaml guide
- Job variables (env, image, etc.): Customize job variables
- Settings and profiles (.env for Prefect settings): Settings and profiles
If you share which work pool you’re using (process, docker, kubernetes) and whether you need to pull from secrets or your OS environment, I can tailor an exact snippet.