Trying again: I tried asking Marvin but the answe...
# ask-community
e
Trying again: I tried asking Marvin but the answers didn't look correct; how do I supply my kube prefect worker with my AWS credentials so it can pull from ECR? Also, in my
prefect.yaml
file, is this the right way to supply my tasks with the necessary env vars?
Copy code
definitions:
  tags: &common_tags
    - "feedback-insight"
    - "demo"
  work_pool: &common_work_pool
    name: "demo-work-pool"
    job_variables:
      image: $BACKEND_IMAGE_URL
      ENV_VAR_1: $ENV_VAR_1
      ENV_VAR_2: $ENV_VAR_2
Seems strange that the docker image would be grouped with the env vars supplied to the pod / execution env
a
Hey @Eric! A Kubernetes work pool comes with a
env
variable in the default base job template, so you can provide environment variables like this:
Copy code
work_pool: &common_work_pool
    name: "demo-work-pool"
    job_variables:
      image: $BACKEND_IMAGE_URL
      env:
        ENV_VAR_1: $ENV_VAR_1
        ENV_VAR_2: $ENV_VAR_2
🙌 1
e
Thanks @alex! So these env vars get sent to the pod executing the flow run right? What about my Prefect worker that is polling the work pool, how do I configure it so that it pulls the docker image from the right ECR?
a
The Kubernetes worker creates a job within the cluster to execute a flow run, but it isn’t responsible for pulling the image. If you give the full ECR image URL to
job_variables.image
and your Kubernetes cluster has the correct permissions to pull images from ECR, your flow runs should execute correctly.
e
Oh I see. So if Fargate is managing my cluster, as long as the role operating that has ECR permissions it should be able to start the flow run?
a
Yep! Let us know if you see any errors from your worker that would indicate that isn’t working as expected.
e
Thanks I'll give that a shot then!