Hey, i’m new to using prefect - but i’ve been tryi...
# prefect-community
a
Hey, i’m new to using prefect - but i’ve been trying to follow along with this tutorial: https://towardsdatascience.com/distributed-data-pipelines-made-easy-with-aws-eks-and-prefect-106984923b30 I have most of it working, pods get spun up when i run a flow. However, they are unable to pull the image from ECR that I have pushed. I keep getting the error (i have replaced the account number and repo name)
Copy code
Message: Failed to pull image "<http://z.dkr.ecr.us-east-1.amazonaws.com/r:latest|z.dkr.ecr.us-east-1.amazonaws.com/r:latest>": rpc error: code = NotFound desc = failed to pull and unpack image "<http://z.dkr.ecr.us-east-1.amazonaws.com/r:latest|z.dkr.ecr.us-east-1.amazonaws.com/r:latest>": failed to resolve reference "<http://z.dkr.ecr.us-east-1.amazonaws.com/r:latest|z.dkr.ecr.us-east-1.amazonaws.com/r:latest>": <http://z.dkr.ecr.us-east-1.amazonaws.com/r:latest|z.dkr.ecr.us-east-1.amazonaws.com/r:latest>: not found
I have followed the tutorial pretty closely, although some stuff what slightly outdated so I used the newer paradigms that were introduced. Any insight on how I could configure my EKS to be able to pull images from the ECR would be appreciated. I also did all of this on my master admin account, so I would think that permissions shouldn’t be an issue
a
Interesting! So it looks like the IAM role used by your Fargate profile doesn’t have access to pull images from ECR. Usually this permission is added automatically. When you use this command:
Copy code
eksctl get fargateprofile --cluster your_cluster_name -o yaml
You should get info about which podExecutionRoleARN is used and you can check in your IAM console what permissions are attached, and if ECR is missing, perhaps you can add it? Still weird, ECR permission is granted by default, do you happen to use a different region in your ECR image as opposed to the region of the cluster?
a
They should both use us-east-1
a
did you check the IAM role?
a
Yeah so the IAM role is FargatePodExecuctionRole, I went to it in IAM last night and attached a JSON policy of:
Copy code
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ecr:BatchCheckLayerAvailability",
        "ecr:BatchGetImage",
        "ecr:GetDownloadUrlForLayer",
        "ecr:GetAuthorizationToken"
      ],
      "Resource": "*"
    }
  ]
}
It also has policies AmazonEKSFargatePodExecutionRolePolicy and AmazonEC2ContainerRegistryReadOnly
So it should have permissions, that’s the confusing part
Any other ideas? I couldn’t think of what other reasons it wouldn’t be able to pull the image. The URL it’s trying to pull from is correct also
a
Based on this, it looks like the permissions need to be a bit broader:
Copy code
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:GetRepositoryPolicy",
"ecr:DescribeRepositories",
"ecr:ListImages",
"ecr:DescribeImages",
"ecr:BatchGetImage",
"ecr:GetLifecyclePolicy",
"ecr:GetLifecyclePolicyPreview",
"ecr:ListTagsForResource",
"ecr:DescribeImageScanFindings"
how did you create your cluster? Was your fargate profile created automatically or manually?
a
it was created automatically
i used the command line has outlined in the tutorial (not that much experience with eks myself)
or fargate
a
as a workaround, you could use Kubernetes secret as shown here, but this secret token is short lived so IAM role is recommended
a
let me update the IAM permissions and see if this works, thanks!
Nope, that didn’t work. The weird thing is it’s not a permission denied error, it seems like a failed to resolve reference error. Not sure if that matters though
I can try the workaround, but IAM would be better. Can’t figure out what i’m missing though, let me see if the workaround works for now though
So even the short term fix doesn’t work, there has to be something obvious outside of permissions that isn’t working
@Anna Geller any other possible thoughts on things I should look into?
a
If nothing else works, you can try everything from scratch (new cluster, new ECR repo), ideally in a different region e.g. us-east-2 You can also contact AWS if you have a paid support plan Lastly, you can check the cloud formation template - eksctl deploys all resources as CloudFormation stack under the hood - you can check the outputs there to check if everything worked correctly
a
And.. this ended up being a typo on my end 😓. Thanks for the help getting this sorted!
🙌 1