InvalidImageName
KubernetesERRORCommonPod LifecycleHIGH confidence

Container image name is not valid

Production Risk

This error prevents deployment, so it stops an application from running but does not affect already running services.

What this means

The value provided for the container image field in the pod specification does not conform to the expected format. This is a syntax or validation error caught by the API server or kubelet.

Why it happens
  1. 1The image name contains invalid characters, like uppercase letters or underscores
  2. 2The image name is missing a required part, like the repository
  3. 3A typo in the image name string
How to reproduce

Applying a deployment or pod manifest fails with a validation error.

trigger — this will error
trigger — this will error
kubectl apply -f my-pod.yaml

expected output

The Pod "my-pod" is invalid:
* spec.containers[0].image: Invalid value: "MyRepo/my-image:latest": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Fix 1

Correct the image name in the manifest

WHEN The image name contains invalid characters or formatting

Correct the image name in the manifest
vi my-pod.yaml

Why this works

Edit the YAML file to ensure the image name follows the DNS subdomain naming conventions (lowercase letters, numbers, hyphens, and dots).

Fix 2

Check for typos

WHEN The error is unexpected and the name looks correct

Check for typos
cat my-pod.yaml

Why this works

Carefully review the image field for subtle typos, extra spaces, or non-printable characters that could cause the validation to fail.

What not to do

Try to bypass the validation

The naming convention is required for compatibility with container runtimes and registries. The name must be fixed.

Sources
Official documentation ↗

k8s.io/apimachinery/pkg/util/validation/validation.go

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Kubernetes errors