Your Kubernetes pulls from Docker Hub keep failing with "toomanyrequests: You have reached your pull rate limit". You decide to move images to ECR. How?
BeginnerScenarioMigrations
Answer
Situation read → All nodes behind one NAT IP share the anonymous Docker Hub pull limit, so a scale-out event or a node replacement can stop the cluster from starting pods.
What I'd do →
- Quick relief: set up an ECR pull-through cache rule for Docker Hub, so the first pull is fetched and cached in your account.
aws ecr create-pull-through-cache-rule \
--ecr-repository-prefix docker-hub \
--upstream-registry-url registry-1.docker.io \
--credential-arn arn:aws:secretsmanager:ap-south-1:111122223333:secret:ecr-pullthroughcache/dockerhub
- Update image references from
nginx:1.27to111122223333.dkr.ecr.ap-south-1.amazonaws.com/docker-hub/library/nginx:1.27. - For your own images, push to ECR from CI and enable scan-on-push and lifecycle policies.
- Enforce it with an admission policy (Kyverno or Gatekeeper) that only allows images from your ECR registry.
Why → Images come from inside AWS (faster, no rate limit, no internet egress), and you control what's allowed to run.
Interview tip → Mention the shared NAT IP; it explains why the limit hits a whole cluster at once.
More on Migrations
Migrate an application from EC2 to EKS with zero downtime. Walk me through it.AdvancedMigrate a database from on-prem MySQL to Amazon RDS with minimal downtime. How?AdvancedYou need to move Terraform state from local files to an S3 backend. How?BeginnerMigrate CI from Jenkins to GitHub Actions for 80 repositories. How do you plan it?IntermediateUpgrade an EKS cluster from 1.30 to 1.31 in production. What's your process?IntermediateMove from a monolith to microservices. What's the DevOps side of the migration?Advanced