I am trying to pull the image from the ECR repository inside the Kubernetes cluster, but I am not able to do this.
I tried creating a secret and updated in the pod file, but I am not able to do this I am getting an error "no basic auth credentials".
Please can anyone give me the step by step instructions to pull the image from a ECR repository inside the Kubernetes cluster.
Your problem may be caused by the fact that ECR credentials work only for 12 hours, so maybe you are trying to use expired credentials.
I recommend you to have a look at upmc-enterprises/registry-creds. This tool can be installed on your cluster and automatically refresh ECR/GCR credentials before they expire.
Alternatively, you can assign an IAM role to the nodes of your cluster to pull the images from ECR. Please find below an example role to pull images from ECR.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage"
],
"Resource": "*"
}
]
}