0
votes

I'm feeling pretty stupid here. I want K8s to pull Docker images from a local registry to ensure my development cycle is as fast as possible.

I have set up the local registry per the instructions and am using an insecure registry. I have pushed images to it, and have confirmed they reside in the registry by looking inside it using VS Code's Docker extension:

Docker images

I didn't really know whether to use localhost, $MACHINE_NAME, or $LOCAL_IP_ADDRESS, so I did all three.

I can successfully pull an image from these registries via the command line. However, when K8s (running via minikube) attempts to pull, it fails:

Failed to pull image "localhost:5000/service1": rpc error: code = Unknown desc = Error response from daemon: Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connect: connection refused

Why is this and how can I rectify?

1
instead of using localhost you have to use the ip address that map minikube to host machine's localhost. This is generally 10.0.2.2 or 10.0.2.15 based on your vm driver. You can determine using running ifconfig inside minikube and check ip in form of 10.0.2.* This github issue might help: github.com/kubernetes/minikube/issues/2735Emruz Hossain

1 Answers

2
votes

You might want to read this blog which provides excellent details on how to set up registry on minikube.

https://blog.hasura.io/sharing-a-local-registry-for-minikube-37c7240d0615/

The idea here is for the docker daemon on minikube to be able to pull from a registry called localhost:5000. This is achieved by actually running a registry on minikube and then setting up a proxy so that the minikube VM port 5000 maps to the registry’s 5000.