Skip to content

k3s: ErrImagePull with "server gave HTTP response to HTTPS client"

Containertested on Ubuntu 24.04, k3s v1.37.2+k3s1, zot v2.1.23 als Registry ohne TLS

The pod starts on one node and stays in ErrImagePull on the other. The registry is running and the image is there. The node only asks the registry over HTTPS, and the registry answers with HTTP.

Symptom

kubectl -n lotse get pods -l app=lotse -o wide
NAME                    READY   STATUS         RESTARTS   AGE   IP          NODE
lotse-f45b4fd95-7cpjd   0/1     ErrImagePull   0          32s   10.42.1.4   werk2

The pod runs on werk2 and never gets past ErrImagePull.

Diagnosis

The pod events name the address the node asked.

kubectl -n lotse describe pod -l app=lotse
Warning  Failed     19s (x2 over 32s)  kubelet            spec.containers{lotse}: Failed to pull image "werk1:5000/bewerbungslotse:1.0.0": failed to pull and unpack image "werk1:5000/bewerbungslotse:1.0.0": failed to resolve reference "werk1:5000/bewerbungslotse:1.0.0": failed to do request: Head "https://werk1:5000/v2/bewerbungslotse/manifests/1.0.0": http: server gave HTTP response to HTTPS client

Causes

registries.yamlThe registry setting is missing on this node

k3s asks every registry over HTTPS unless /etc/rancher/k3s/registries.yaml says otherwise. The file must exist on every node that pulls images, not only on the server.

restartk3s reads the file only at startup

A new or changed registries.yaml takes effect only after systemctl restart k3s (server) or k3s-agent (agent).

Fix

Create the file with an http:// endpoint and restart the agent; then let the pod restart.
sudo nano /etc/rancher/k3s/registries.yaml
mirrors:
  "werk1:5000":
    endpoint:
      - "http://werk1:5000"

sudo systemctl restart k3s-agent
kubectl -n lotse delete pod -l app=lotse

Don't: Create the file only on the server. Every node pulls its own images.

▶
Break it yourself and find it – free
Compliance engineering: CRA and AI Act on Kubernetes, day 0: the site – two VMs, k3s, your own registry and the Bewerbungslotse.
Go to day 0 →

FAQ

Why does the pod start on the server node?

The registries.yaml is there, or the image is already cached. The error only shows when a node without the file has to pull the image again.

Is deleting the image on the node enough?

No, that only reproduces the error. It is fixed by the file and an agent restart.

Related error patterns

More