If crictl can pull an image from localhost, why does k3s fail to deploy it on localhost?

9/9/2019

I have installed k3s on a cluster of raspberry pi's.

pi@pikey:~ $ sudo kubectl get node 
NAME       STATUS   ROLES    AGE     VERSION
pikey      Ready    master   4d23h   v1.14.6-k3s.1
pinode-1   Ready    worker   4d23h   v1.14.6-k3s.1
pinode-2   Ready    worker   4d23h   v1.14.6-k3s.1
pinode-3   Ready    worker   4d23h   v1.14.6-k3s.1

I'm initially working on localhost (pikey) only.

I've got a docker image that I tagged and pushed into crictl

pi@pikey:~ $ sudo crictl pull localhost:5000/pilab/node-intro-img
Image is up to date for sha256:7a2c45e77748e6b2282210d7d54b12f0cb25c4b224c222149d7a66653512f543
pi@pikey:~ $ sudo kubectl delete deployment node-intro
deployment.extensions "node-intro" deleted
pi@pikey:~ $ sudo crictl images
IMAGE                                 TAG                 IMAGE ID            SIZE
docker.io/coredns/coredns             1.3.0               6d816a3a1d703       11.5MB
docker.io/library/traefik             1.7.12              a0fc65eddfcc8       19.1MB
docker.io/rancher/klipper-helm        v0.1.5              d4a37f6d19104       25.4MB
docker.io/rancher/klipper-lb          v0.1.1              36563d1beb5e2       2.58MB
k8s.gcr.io/pause                      3.1                 e11a8cbeda868       224kB
localhost:5000/pilab/node-intro-img   latest              7a2c45e77748e       320MB

Now if I try and deploy

sudo kubectl create deployment node-intro --image=localhost:5000/pilab/node-intro-img

I get

pi@pikey:~ $ sudo kubectl get pods
NAME                          READY   STATUS             RESTARTS   AGE
node-intro-567c59c8c7-9p5c5   0/1     ImagePullBackOff   0          101s
pi@pikey:~ $ sudo kubectl get pods
NAME                          READY   STATUS         RESTARTS   AGE
node-intro-567c59c8c7-9p5c5   0/1     ErrImagePull   0          104s

If crictl can pull an image, why does k3s fail to deploy it?

-- Andrew Bucknell
docker
k3s
kubernetes

1 Answer

9/9/2019

You're using loclahost:5000/... as the image location.

However are you sure that the image is present on each node ? Maybe the node on which the image is deploying just does not host the image.
Either use the IP address of the node hosting the registry, or make sure the image is present on each node.

-- Marc ABOUCHACRA
Source: StackOverflow