Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Docker Image in ECR with AWS EKS

I have created EKS Cluster. I also have docker image in ECR. I am not sure how to use the docker image in pod definition in YAML.

Is it required to give credentials in secret? or EKS IAM role should have permission for ECR?

Any changes in permission have to do for Image in ECR ?

like image 530
Karthik Avatar asked Jan 09 '19 11:01

Karthik


People also ask

Does Docker images used in Amazon ECS and EKS can be stored in Amazon ECR?

Yes. Amazon ECR is integrated with Amazon ECS, allowing you to easily store, run, and manage container images for applications running on Amazon ECS. All you need to do is specify the Amazon ECR repository in your task definition and Amazon ECS will retrieve the appropriate images for your applications.

Can EKS access ECR?

You can use your Amazon ECR images with Amazon EKS, but you need to satisfy the following prerequisites. For Amazon EKS workloads hosted on managed or self-managed nodes, the Amazon EKS worker node IAM role ( NodeInstanceRole ) is required.


1 Answers

If you followed the EKS getting started guide, everything will work out of the box and you just have to specify the the full image name (e.g. ACCOUNT.dkr.ecr.REGION.amazonaws.com/imagename:tag) in the Pod definition (spec.containers.image field).

It works because Kubernetes has native support for ECR and the CloudFormation template for the Kubernetes worker nodes attaches an AmazonEC2ContainerRegistryReadOnly policy to the instance profile.

like image 132
mrucci Avatar answered Sep 30 '22 18:09

mrucci