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 →

  1. 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
  1. Update image references from nginx:1.27 to 111122223333.dkr.ecr.ap-south-1.amazonaws.com/docker-hub/library/nginx:1.27.
  2. For your own images, push to ECR from CI and enable scan-on-push and lifecycle policies.
  3. 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.

All Real-World Interview questions Roadmap: Interview readiness

More on Migrations