Pod In InvalidImageName State
Lastmod: 2023-01-26

Overview

An InvalidImageName error occurs when kubelet attempts to pull a container image from the container registry and the image name reference is not correct.

Check RunBook Match

When running a kubectl get pods command, you will see a line like this in the output for your pod:

NAME                     READY     STATUS             RESTARTS   AGE
nginx-7ef9efa7cd-qasd2   0/1       InvalidImageName   0          1m

Initial Steps Overview

  1. Gather information

  2. Examine Events section in describe output

  3. Check the error message

Detailed Steps

1) Gather information

Run this commands to gather relevant information in one step:

kubectl describe -n [NAMESPACE_NAME] pod [POD_NAME]` > /tmp/runbooks_describe_pod.txt

2) Examine Events section in describe output

2.1) Invalid reference format

If you see lines that look like:

Type     Reason         Age                   From               Message
----     ------         ----                  ----               -------
Normal   Scheduled      2m45s                 default-scheduler  Successfully assigned default/nginx-7ef9efa7cd-qasd2 to kind-control-plane
Warning  Failed         38s (x12 over 2m45s)  kubelet            Error: InvalidImageName
Warning  InspectFailed  24s (x13 over 2m45s)  kubelet            Failed to apply default image tag "https://docker.io/nginx:latest": couldn't parse image reference "https://docker.io/nginx:latest": invalid reference format

Then this indicates that the container image reference you have specified can’t be parsed, therefore kubelet from the node the pod has been scheduled to can’t pull the container image.

Solutions List

A) Review the image reference

Solutions Detail

A) Add credentials

Review the container image reference in your manifest. The container image has two parts, the image name and the image tag. You can include a container registry hostname and the port as well. Protocols like http://, ssh://, docker:// are not allowed and can lead to this issue. The container image tag consists of lowercase and uppercase letters, digits, underscores, periods and dashes, any other symbol can cause this issue to appear.

Check Resolution

If the pod starts up with status RUNNING according to the output of kubectl get pods, then the issue has been resolved.

If there is a different status, then it may be that this issue is resolved, but a new issue has been revealed.

Further Steps

None

Further Information

Image names documentation

Owner

Carlos Vicent Domenech

comments powered by Disqus