Question

Failed to pull image from private repository on kubernetes cluster

Hello,

I’m using DO’s new kubernetes cluster and it seems there’s an issue pulling an image form a private repository. I am using GitLab on the cluster with a configured docker registry. The registry works and I can pull the image locally. However when deploying on kubernetes I get the following error:

“Failed to pull image {redacted}: rpc error: code = Unknown desc = Error response from daemon: Get {redacted}: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)”

From related issues online it appears most people get this error with a proxy/dns issue so could this be an internal DO issue?

The request is not even logged on the registry server so it does not appear to be an authentication issue either. (Although I have a dockercfg secret setup for authentication)

Thanks, Ryan

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I had the same issue when running private registry on the DO cluster. I fixed it by scaling up registry to run on all nodes. It seems to be a weird routing issue with the DO loadbalancer when addressing the outside IP from inside the cluster. DO k8s controller tries to be smart and routes node requests internally, instead of sending traffic to the loadbalancer IP. The issue though that if there is no registry service on that node, the packets go nowhere. So, scale up or route through a non-DO LB.

Here’s what I did as a workaround:

  1. Set up your docker-registry ingress as usual (with tls etc.)
  2. Point your registry domain to your load balancer (as usual)
  3. Log in to your nodes via ssh
  4. Add the cluster IP of your ingress-controller to /etc/hosts
  <ingress controller IP> registry.example.com

Use the domain name when deploying images in the cluster (e.g registry.example.com/image)

If your /etc/hosts is managed you might need to update your /etc/cloud/templates/host.*.tmpl as well.

Any update on this ? Having the same issue here