<@ULVA73B9P> i'm trying to install a prefect worke...
# ask-marvin
y
@Marvin i'm trying to install a prefect worker on kubernetes using the helm chart in prefect-helm how can i override the image used in the job within the job template?
m
thought for 278.1 seconds
Short answer: set the work pool’s base job template to use your image. In Prefect 3.x, the image used by the Kubernetes Job that runs your flow is controlled by the work pool’s base job template, not the worker pod’s image. There are two common ways to override it when using the prefect-helm worker chart: 1) Set the image via base job template variables (simplest) - In your Helm values, set the
image
variable for the pool’s base job template. The worker chart will use the default Kubernetes base job template and apply these variables.
Copy code
worker:
  config:
    workPool: my-k8s-pool
    baseJobTemplate:
      variables:
        image: <http://ghcr.io/acme/prefect-flows:2025.08.10|ghcr.io/acme/prefect-flows:2025.08.10>
        # optional but common:
        namespace: my-flows
        image_pull_policy: IfNotPresent
2) Provide a full base job template JSON and pin the image there - Get the default template:
Copy code
prefect work-pool get-default-base-job-template --type kubernetes > base-job-template.json
- Edit it to set either: -
"variables": { "image": "<http://ghcr.io/acme/prefect-flows:2025.08.10|ghcr.io/acme/prefect-flows:2025.08.10>" }
(recommended), or - hardcode the container image in
job_configuration.job_manifest.spec.template.spec.containers[0].image
if you want to ignore deployment-level images entirely. - Install/upgrade with the template:
Copy code
helm upgrade --install prefect-worker prefect/prefect-worker \
  -n your-namespace \
  --set worker.config.workPool=my-k8s-pool \
  --set-file worker.config.baseJobTemplate.configuration=base-job-template.json
Notes and common gotchas - The worker pod’s own image is configured separately via the chart’s
image.repository
and tag; that does not affect the flow-run Job image. - A deployment that sets an
image
will override the pool default. If you hardcode the image inside
job_manifest
, you’ll effectively ignore deployment-provided images. - If you already have a ConfigMap with the JSON, you can point the chart at it (handy for GitOps). Helpful links - Chart README (section “Configuring a base job template on the worker”): prefect-helm prefect-worker README - Values reference: prefect-worker values.yaml - Prefect 3.x Kubernetes work pool docs: Kubernetes work pool how-to Just to confirm: do you want a single default image for all flow runs from this work pool, or do you also plan to override per-deployment? I can tailor the snippet either way. If only I could tailor the weather too.
m
let me know if you hit a dead end here @Yu Shao Pang, this area of the configuration is sometimes tough to work with
❤️ 1
y
much appreciated! I've not worked with prefect much before and am tasked to look into deploying an instance so it's been mostly struggles 😄
m
we have some docs on this here - give that a try and see if that helps!