https://prefect.io logo
Title
g

Guillaume G

09/27/2022, 7:25 AM
Hi Prefect, Is there a way to configure a docker registry with credentials in a
KubernetesJob
? I want to pull a image from a private registry.
reception_deployment : Deployment = Deployment.build_from_flow(
    name="private-flow",
    flow=main_flow,
    output="deployment-private-flow.yaml",
    description="private-flow",
    version="snapshot",
    work_queue_name="kubernetes",
    infrastructure=KubernetesJob(), 
    infra_overrides=dict(
        image="myprivate-image:latest",
        env={},
        finished_job_ttl=300)
    )
I can not pull
"myprivate-image:latest"
Do I have to use
service_account
? ๐Ÿคจ Thank you
โœ… 1
r

Rob Freedy

09/27/2022, 2:34 PM
Hey @Guillaume G!! I would recommend looking at this discourse post, specifically the "Customize the Job Template" part. You could pass a job template in the
KubernetesJob()
and specify
imagePullSecrets
in that job template. https://discourse.prefect.io/t/creating-and-deploying-a-custom-kubernetes-infrastructure-block/1531#h-2-customize-the-template-5 https://stackoverflow.com/questions/40782458/how-to-define-kubernetes-job-using-a-private-docker-registry https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#registry-secret-existing-credentials
๐Ÿ‘ 1
๐Ÿ˜ 1