using kind to pull images from a local registry
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
KIND (Kubernetes IN Docker) runs Kubernetes clusters inside Docker containers for local development and testing. By default, KIND nodes cannot pull images from a local Docker registry because the cluster network is isolated. Configuring KIND to use a local registry lets you test custom images without pushing them to a remote registry like Docker Hub.
Prerequisites
- Docker: Ensure Docker is installed and running on your local machine
- kind: Install from the official GitHub repository
- kubectl: Install to interact with your kind cluster
Step 1: Create a Local Docker Registry
Step 2: Create a KIND Cluster Connected to the Registry
Create a kind-config.yaml:
Create the cluster:
Step 3: Connect the Registry to the KIND Network
Step 4: Configure the Registry as a Local ConfigMap
This tells Kubernetes about the local registry:
Step 5: Build, Tag, and Push Images
Step 6: Deploy Using the Local Registry Image
Complete Setup Script
The KIND project provides an official script that automates all the steps:
Alternative: kind load docker-image
For one-off testing, you can load images directly into KIND nodes without a registry:
This is simpler but does not scale well for multiple images or CI pipelines.
Common Pitfalls
- Network isolation: KIND nodes run in Docker containers with their own network. The registry must be on the same Docker network (
kind) for nodes to reach it. - Image pull policy: Set
imagePullPolicy: IfNotPresentorimagePullPolicy: Neverfor local images. The defaultAlwaystries to pull from a remote registry and fails. - Port mapping: The registry runs on port 5000 internally but is exposed on port 5001 to avoid conflicts. Use
localhost:5001when pushing and in pod specs. - Cluster recreation: If you delete and recreate the KIND cluster, reconnect the registry to the new
kindDocker network. - containerd vs Docker: KIND uses containerd, not Docker, inside nodes. The
containerdConfigPatchesin the cluster config tells containerd where to find the registry.
Summary
- Run a local Docker registry and connect it to the KIND Docker network
- Configure KIND's containerd to mirror
localhost:5001to the registry container - Tag and push images to
localhost:5001/image:tag - Reference the same image path in Kubernetes pod specs
- For quick tests, use
kind load docker-imageto bypass the registry entirely
Related reading
- Using kubectl set image to update image of initContainer
- Using minikube to pull image from local Docker registry with self-signed CA certificate
- Using minikube with --driverdocker fails to forward from localhost to minikube internal address
- Using pod Anti Affinity to force only 1 pod per node
- Using rabbitmq with docker in production
- Using SSH keys inside docker container
- Using logging in multiple modules
- Using ls to list directories and their total sizes

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.