Dan Morris
08/29/2025, 8:42 AMMarvin
08/29/2025, 8:42 AMcheck_cli_command
📊 Tools used:
• check_cli_command
(7x)
• explore_module_offerings
(3x)Dan Morris
08/29/2025, 9:38 AMMarvin
08/29/2025, 9:38 AMMarvin
08/29/2025, 9:45 AMbuild=False
and push=False
are exactly right for “use an existing image.”
- Make sure the image
string is the plain name (e.g., `my-acr.azurecr.io/prefectjobs:latest`). Slack sometimes adds <...|...>
link formatting — don’t paste that into code.
- If your code lives inside the image, this is perfect. If your code lives in a repo instead, consider Flow.from_source(...).deploy(...)
.
Your example (cleaned up for Slack formatting) would be:
from prefect import flow
@flow
def my_flow():
print("hello from ACR image")
if __name__ == "__main__":
my_flow.deploy(
name="my-flow",
work_pool_name="my-aks",
image="<http://my-acr.azurecr.io/prefectjobs:latest|my-acr.azurecr.io/prefectjobs:latest>",
build=False,
push=False,
# cron="0 * * * *", # optional
)
Kubernetes work pool + ACR auth (AKS) tips:
- If AKS is attached to your ACR (via Azure RBAC), you may not need an imagePullSecret
.
- Otherwise, add imagePullSecrets
and (optionally) a serviceAccountName
to your Kubernetes work pool’s base job template.
You can grab Prefect’s default Kubernetes job template, edit it, and update your work pool:
prefect work-pool get-default-base-job-template --type kubernetes --file k8s-base.json
# Edit k8s-base.json -> add under job_manifest.spec.template.spec:
# "imagePullSecrets": [{"name": "acr-pull-secret"}],
# "serviceAccountName": "prefect-runner"
prefect work-pool update my-aks --base-job-template k8s-base.json
Docs to keep handy:
- Kubernetes work pools and job templates: Prefect 3: Run on Kubernetes
- Managing work pools: Prefect 3: Manage work pools
If you want, I can draft a minimal k8s-base.json
with imagePullSecrets
and a service account for your my-aks
pool.