Pablo MARTIN CALVO
03/23/2026, 2:21 PMMarvin
03/23/2026, 2:21 PMMarvin
03/23/2026, 2:26 PMnamespace (defaults to default).
- You can set that default in the Helm chart under worker.config.baseJobTemplate.configuration.
- There’s also a worker.config.jobNamespace value, but that only controls which namespaces the worker’s observer watches for pod events; it does not control where jobs are created.
How to set the job creation namespace via Helm (values.yaml):
worker:
config:
workPool: my-k8s-pool
baseJobTemplate:
configuration: |
{
"variables": {
"namespace": {
"default": "my-target-namespace",
"type": "string",
"description": "The Kubernetes namespace to create jobs within."
}
},
"job_configuration": {
"job_manifest": {
"metadata": {
"namespace": "{{ namespace }}"
}
}
}
}
Notes:
- Default behavior: if you do nothing, jobs are created in the Kubernetes “default” namespace.
- Per-deployment override: you can override the namespace per deployment using `job_variables`:
deployments:
- name: my-deployment
work_pool:
name: my-kubernetes-pool
job_variables:
namespace: staging
- Observer vs. job creation: if you meant “which namespaces the worker watches for pod events,” set:
worker:
config:
jobNamespace: "default,my-target-namespace"
This does not affect where jobs are created.
Helpful links:
- Prefect Kubernetes guide (work pools and namespace behavior): Kubernetes deployment guide
- Customizing base job templates: Customize base job templates
- Helm chart (prefect-worker) README and values:
- prefect-worker chart README
- values.yaml
- Self-hosting/Helm overview: Self-host with Helm
Do you want to:
- change the namespace where the worker itself is installed (Helm release namespace), or
- change the namespace where it creates Jobs, or
- change which namespaces it observes for pod events?
If it’s the second, the base job template shown above is the right approach. Also ensure the worker’s ServiceAccount has RBAC permissions in the target namespace(s).Pablo MARTIN CALVO
03/24/2026, 8:41 AMMarvin
03/24/2026, 8:41 AMMarvin
03/24/2026, 8:46 AMnamespace) live in the base job template’s variables section. So changing the default namespace means updating that template. That said, you don’t have to rewrite the whole manifest—just change the variables.namespace.default and leave everything else as-is.
Easiest options:
- Prefect UI: Work Pools → your Kubernetes pool → Edit → set the “Namespace” field → Save. Under the hood this updates the base job template’s default for namespace.
- Prefect CLI (verified):
prefect work-pool get-default-base-job-template --type kubernetes -f base-job-template.json
# edit base-job-template.json -> set variables.properties.namespace.default to your value
prefect work-pool update <your-pool> --base-job-template base-job-template.json
- Helm (bake it in): Provide the full template JSON (with only the default changed) via worker.config.baseJobTemplate.configuration.
Per-deployment alternative (no pool default change):
deployments:
- name: my-deployment
work_pool:
name: my-kubernetes-pool
job_variables:
namespace: staging
Notes:
- worker.config.jobNamespace in the Helm chart only controls which namespaces the worker’s observer watches; it does not set where jobs are created.
- Default behavior if you do nothing: jobs are created in the default Kubernetes namespace.
Docs:
- Kubernetes guide: Kubernetes deployment guide
- Customize base job templates: Customize base job templates
- Helm chart: prefect-worker chart README and values.yaml
If you’d like, tell me your target namespace and I can generate a minimal base job template snippet that only changes that default while leaving everything else intact.