Hello, Having issues getting k8s flow run to pull ...
# ask-community
p
Hello, Having issues getting k8s flow run to pull custom image from our dockerhub repo. Getting "Failed to pull image "myrepo/myimage:dev-prefect2": rpc error: code = Unknown desc = failed to pull and unpack image" error. Secret for our docker hub repo is a k8s secret. In prefect 1 I would set the run_config=KubernetesRun(image="myrepo/myimage:0.0.44", image_pull_secrets=['dockercloud-secret'], cpu_request=4, memory_request=16, env=env_var), How should I be doing this in prefect 2? Where should it go? Kind of confused who needs the secret. In my head the worker should know how to pull the image. I have tried setting it in the deployment like the following based on another post but is still failing. deployments: - name: dev version: null tags: [] description: null entrypoint: my_flow.py:my_flow parameters: {} work_pool: name: dev-workpool work_queue_name: null image: myrepo/myimage:dev-prefect2 job_variables: {image_pull_secrets: ['dockercloud-secret']}
k
image_pull_secrets
doesn't exist by default on the job template in the kubernetes work pool. You'll need to add it to that template by going to the Advanced tab on the Edit page of your work pool. If you need additional guidance about editing the template, reply here and I can come up with an example for you.
p
Thanks Kevin, where would I put it in the advanced tab?
c
hi @Peter Peter, FYI I had the same issue and I solved it by adding it to the
spec
section of the job manifest within the
template
.
Copy code
{
  "variables": {
    ...
  },
  "job_configuration": {
    ...
    "job_manifest": {
      "kind": "Job",
      "spec": {
        "template": {
          "spec": {
            "containers": [
              {
                ...
              }
            ],
            "imagePullSecrets": [  // Add this section
              {
                "name": "yourValue"
              }
            ],
            "completions": 1,
            ...
          }
        },
        ...
      },
      ...
    },
    ...
  }
}
k
hi, sorry for not replying earlier - I was moving across the country and just arrived last night. thank you @Clément Frison for the example!
d
I needed this as well, thank you 🙂