Why am I getting ErrImagePull error in this Kubernetes deployment?

I am trying to create a local Kubernetes deployment using Minikube, Docker Registry and a node demo project.

The first thing I did was install Docker v 1.12.3, then Minikube v0.12.2.

Then I created the Docker registry container by running this command (through this tutorial , only by running the first command below)

docker run -d -p 5000:5000 --name registry registry:2 

Then I ran the minikube command to create a local cluster of tunnels:

 minikube start --vm-driver="virtualbox" --insecure-registry="0.0.0.0:5000" 

My project structure is as follows:

 . ├── Dockerfile └── server.js 

and my Docker file looks like this:

 FROM node:7.1.0 EXPOSE 8080 COPY server.js . CMD node server.js 

Then I built my own docker image and uploaded it to my private repository:

 docker build -t hello-node . docker tag hello-node localhost:5000/hello-node docker push localhost:5000/hello-node 

Then I tried to start the deployment using this command:

 kubectl run hello-node --image=localhost:5000/hello-node --port=8888 

But then I get the following:

 sudo kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE default hello-node-3745105022-gzs5a 0/1 ErrImagePull 0 11m kube-system kube-addon-manager-minikube 1/1 Running 4 10d kube-system kube-dns-v20-2x64k 3/3 Running 12 10d kube-system kubernetes-dashboard-mjpjv 1/1 Running 4 10d 

I think that maybe I missed some authentication of the docker registry, but since I search Google, I can not find what I understand. Can someone point me in the right direction?

Edit

After using ssh to access bash on the kubernetes virtual machine and pull the hello-node image from my personal registry using this command:

 minikube ssh Boot2Docker version 1.11.1, build master : 901340f - Fri Jul 1 22:52:19 UTC 2016 Docker version 1.11.1, build 5604cbe docker@minikube:~$ sudo docker pull localhost:5000/hello-node Using default tag: latest Pulling repository localhost:5000/hello-node Error while pulling image: Get http://localhost:5000/v1/repositories/hello-node/images: dial tcp 127.0.0.1:5000: getsockopt: connection refused 

Is localhost:5000 correct address to use in the kubernetes host virtual machine?

+8
docker docker-registry kubernetes
source share
1 answer

It looks like you are using the registry on the host. In fact, you need to run the registry inside the virtual machine. You can point your docker client to the docker daemon inside the minikube virtual machine by first executing this eval $(minikube docker-env) in your shell.

You can then run the docker build command on your host, but it will be built inside the virtual machine.

In fact, if your goal is to simply run the local version of your images, you should run eval $(minikube docker-env) to point to the eval $(minikube docker-env) daemon in your virtual machine and set imagePullPolicy: IfNotPresent in your YAML core. The kubernets will then use the locally constructed image, if available.

+14
source share

All Articles