Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker has image, but kubernetes says not

Tags:

kubernetes

I was trying to build with Kubernetes, and I was wanted to use the local image which I pulled in the early days to save time.(So it does not have to pull a image every time a container is created).The problem is that Kubernetes just ignored my local images.

For example. when I run docker images, I got this in the list

gcr.io/google_containers/k8s-dns-kube-dns-amd64                               1.14.1              f8363dbf447b        7 months ago        52.36 MB

But when I tried to build a deployment with the config(just a part of the config file)

image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.1
imagePullPolicy: Never

It said Container image "gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.1" is not present with pull policy of Never

I wonder if there is anything I missed. Thanks for help!

like image 289
Tsonglew Avatar asked Oct 18 '17 15:10

Tsonglew


People also ask

Does Kubernetes use Docker images?

Kubernetes can still run containers built using Docker's Open Container Initiative (OCI) image format, meaning you can still use Dockerfiles and build your container images using Docker. Kubernetes will also continue to be able to pull from Docker registries (such as Docker hub).

How do I resolve ImagePullBackOff error in Kubernetes?

To resolve it, double check the pod specification and ensure that the repository and image are specified correctly. If this still doesn't work, there may be a network issue preventing access to the container registry. Look in the describe pod text file to obtain the hostname of the Kubernetes node.

What is ImagePullBackOff status in Kubernetes?

The status ImagePullBackOff means that a Pod couldn't start, because Kubernetes couldn't pull a container image. The 'BackOff' part means that Kubernetes will keep trying to pull the image, with an increasing delay ('back-off').


Video Answer


2 Answers

If you are using a Kubernetes cluster, you have to make sure the Docker image you need is available in all nodes, as you don't really know which one will get assigned the Pod.

So: pull/build the needed image from each cluster node.

like image 74
Enrico M. Avatar answered Sep 18 '22 02:09

Enrico M.


If you look closely, you'll notice that the name of the image it's saying is missing is not the same as the one you pulled yourself. It looks like you're attempting to deploy kube-dns, which is made up of multiple images. You'll need to pull each one of them (or allow Kubernetes to pull them on your behalf) for the entire thing to work. Take a look at the configuration files you're using to deploy again—you should find other containers in the pod specifying the other images.

like image 30
Jimmy Avatar answered Sep 18 '22 02:09

Jimmy