k3s-io / k3s

Lightweight Kubernetes

Home Page:https://k3s.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embedded registry mirror pulling failed

spencerswagger opened this issue · comments

Environmental Info:
K3s Version:

v1.29.1+k3s1 (6d77b7a)

Node(s) CPU architecture, OS, and Version:
Ubuntu 22.04.4 amd64

Cluster Configuration:
single server

Describe the bug:

When i create a deployment after Installing k3s (air-gap).
ErrImagePull: Failed to pull image "example/myimage:1.0.0": failed to pull and unpack image "docker.io/example/myimage:1.0.0": failed to resolve reference "docker.io/example/myimage:1.0.0": unexpected status from HEAD request to https://127.0.0.1:6443/v2/example/myimage/manifests/1.0.0?ns=docker.io: 500 Internal Server Error

Steps To Reproduce:

  • Registry Config
mirrors:
  docker.io:
    endpoint:
      - http://172.20.0.1:5000
  • Host Private Image Registry
docker run -d   -p 5000:5000   --restart=always   --name registry   registry:2
  • Push Image
docker push 172.20.0.1:5000/example/myimage:1.0.0
  • Installed K3s:
INSTALL_K3S_SKIP_DOWNLOAD=true K3S_DATASTORE_ENDPOINT="postgres://username:password@172.20.0.1,172.20.0.2,172.20.0.3:5436/dev?target_session_attrs=primary" INSTALL_K3S_EXEC="server --embedded-registry --disable=traefik" ./install.sh
  • Create Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-deployment
  labels:
    app: my-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-container
        image: example/myimage:1.0.0

Expected behavior:

Pulling from private image registry for the 1st time.
After that, pulling from the embedded registry.
Actual behavior:

Pulling from embedded registry failed with 500 code for the 1st time
No failback to private image registry

Additional context / logs: