Problem pulling images when running private docker registry inside of Kubernetes
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Running a private registry inside Kubernetes is common for air-gapped clusters and controlled software supply chains, but image pull failures can come from several layers at once. DNS, TLS, authentication, and runtime trust settings all affect whether pods can download images. A structured troubleshooting flow is the fastest way to resolve these errors.
Core Sections
Typical Failure Symptoms
You usually see one of these event messages:
- '
ImagePullBackOff' - '
ErrImagePull' - unauthorized or authentication required
- x509 certificate error
- no such host or connection refused
Start by reading pod events first:
The exact error string points to the right layer.
Verify Registry Service Reachability
If registry runs in-cluster, verify service and endpoint health:
From a debug pod, test DNS and HTTP response:
A healthy unauthenticated registry endpoint returns a response associated with the v2 API path.
Configure Image Pull Secrets Correctly
For authenticated registries, create and reference a docker-registry secret:
Attach to service account or pod spec:
Confirm namespace alignment. Secrets are namespace-scoped.
Handle TLS and Certificate Trust
If registry uses self-signed or private CA certificates, node runtimes must trust that CA. Adding cert only in application pod does not fix image pull, because pull happens at node runtime level.
High-level fix path:
- install CA cert on all worker nodes
- configure container runtime trust store for registry host
- restart runtime if required
For managed clusters, use provider-supported node image customization or daemon configuration methods.
Avoid Insecure Registry Misconfiguration
Using plain HTTP registry without runtime configuration causes pull failures. If you intentionally run insecure registry in dev, container runtime must explicitly allow it.
In production, prefer TLS with valid certificates and avoid insecure registry flags.
Registry Deployment Basics That Matter
A minimal reliable deployment includes:
- persistent volume for registry storage
- readiness probes on registry pod
- stable service name
- optional ingress with TLS termination
Without persistent storage, restarts can make previously pushed images unavailable.
Confirm Image Name and Tag
Many failures are simple naming mistakes:
Check:
- correct registry host
- repository path
- exact tag
- no hidden typo in deployment manifest
Use kubectl get deploy -o yaml to inspect final applied image string.
End-to-End Verification Workflow
After changes, verify in this order:
- push test image to registry
- pull test image from node or debug environment
- deploy a pod with same image reference
- monitor events until pod reaches running state
This staged check reduces false assumptions and narrows fault domain.
Observability and Incident Prevention
To prevent repeat incidents:
- monitor registry pod health and storage usage
- alert on image pull error rates in cluster events
- document pull secret rotation process
- maintain registry certificate expiry alerts
Most recurring pull issues are operational drift, not one-time bugs.
Common Pitfalls
- Creating image pull secret in wrong namespace.
- Trusting self-signed cert only inside app containers instead of node runtime.
- Using internal service DNS name in image reference where nodes need externally resolvable host.
- Forgetting persistent storage for registry and losing images after restart.
- Debugging deployment logic before confirming raw registry connectivity and authentication.
Summary
- Start with pod events to classify image pull failures by layer.
- Validate registry reachability, authentication, and certificate trust in order.
- Configure
imagePullSecretsper namespace and workload context. - Use TLS and stable registry deployment practices for production reliability.
- Add monitoring and runbooks to prevent recurring pull incidents.
Related reading
- Problem with dynamic persistent volume in Helm
- Problem with escaping password with special characters in Kubernetes cloudsql
- Problem with minikube and nginx ingress when reinstalled minikube
- Production ready Python apps on Kubernetes
- Programmatically get the name of the pod that a container belongs to in Kubernetes?
- Provide static IP to docker containers via docker-compose
- problem with couchdb remote replication ubuntu local CentOS remote
- Problem with Dataloader object not subscriptable

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.