Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minikube Unable to pull images from AWS ECR on Kubernetes >v1.26.1 #19653

Open
itayvolo opened this issue Sep 16, 2024 · 4 comments
Open

Minikube Unable to pull images from AWS ECR on Kubernetes >v1.26.1 #19653

itayvolo opened this issue Sep 16, 2024 · 4 comments

Comments

@itayvolo
Copy link

itayvolo commented Sep 16, 2024

What Happened?

I'm using Minikube on an AWS EC2 instance (amazonlinux2023) running Kubernetes v1.29.1 with 'Containerd' as the container runtime.
The goal is to pull images from a private Amazon ECR repository using the EC2 IAM instance role permissions, without storing explicit credentials.

Everything was working fine with just the IAM instance role until I've decided to upgrade the k8s version from v1.26.1.
However, when Minikube attempts to pull these images in pods, it fails with an authentication error (e.g., "no basic auth credentials").

How can I configure Minikube to use the EC2 IAM instance role for pulling images access, just as it worked before?

How to reproduce:

  • Create a minikube cluster with k8s v1.26.1
  • Run a pod with an image from private ECR repository
kubectl run <pod_name> --image '<account_id>.dkr.ecr.<region>.amazonaws.com/nginx:latest'
  • Observe a running pod - successful image pull
  • Delete minikube cluster
  • Create a new minikube cluster with k8s version >v1.26.1
  • Run a pod with an image from private ECR repository
kubectl run <pod_name> --image '<account_id>.dkr.ecr.<region>.amazonaws.com/nginx:latest'
  • Observe a failed pod - image pull failure
Failed to pull image "<account_id>.dkr.ecr.<region>.amazonaws.com/nginx:latest": failed to pull and unpack image "<account_id>.dkr.ecr.<region>.amazonaws.com/nginx:latest": failed to resolve reference "<account_id>.dkr.ecr.<region>.amazonaws.com/nginx:latest": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials

Operating System

Other

Driver

None (Baremetal)

@Helion55
Copy link

Helion55 commented Sep 18, 2024

You need to create a secret on your namespace which will store the credentials of your private container registry to pull the image.
Try this command to create the secret.

kubectl create secret docker-registry <YOUR-SECRET-NAME>   --docker-server=<URL of the Amazon ECR repository>  --docker-username=<Amazon ECR repository-USERNAME>   --docker-password=<"Amazon ECR repository ACCESS-TOKEN"> or <Amazon ECR repository Password> -n <YOUR-NAMESPACE>

@itayvolo
Copy link
Author

itayvolo commented Sep 18, 2024

@Helion55 As I mentioned in the description, it was working fine before the k8s upgrade with just the iam instance role and without registry-creds,
I'm trying to avoid using registry creds and specifying aws key and secret, how can I make it work as it was before?

@amitde69
Copy link

amitde69 commented Sep 19, 2024

same here, is there a way to make minikube pull images from ECR without configuring anything except an IAM role that allows ECR access ?
It worked before k8s 1.27.1

@mdylan2
Copy link

mdylan2 commented Oct 11, 2024

Bumping this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants