Using an ECR image in your EKS cluster
EKS worker nodes can pull images from ECR as they should have the AmazonEC2ContainerRegistryReadOnly
managed role applied to the worker nodes.
So, the only thing that needs to be done is to specify the full <aws_account_id>.dkr.ecr.aws_region.amazonaws.com/<image-name>:<tag>
ECR path in your Kubernetes manifest or Helm chart.
Building on Chapter 4, Running Your First Application on EKS, we create a deployment that uses our myapp
container and a NodePort
service that exposes that service outside the cluster. The only real difference is in the Pod spec, we reference the fully qualified image name. This is illustrated next. The first section defines the Kubernetes Deployment:
--- apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment spec: selector: matchLabels: app: fastapi replicas: 1 template: ...