I'm attempting to use containers published to a private Docker Pro registry with K3s.
I've configured /etc/rancher/k3s/registries.yaml
mirrors: docker.io: endpoint: - "https://docker.io"configs: docker.io: auth: username: mydockerprouser password: dckr_pat_randomstuffgoeshere
Once deployed I restart k3s and check to see if crictl is configured to use a registry by running sudo k3s crictl info
"registry": {"configPath": "","mirrors": {"docker.io": {"endpoint": ["https://docker.io" ],"rewrite": null } },"configs": {"docker.io": {"auth": {"username": "mydockerprouser","password": "dckr_pat_randomstuffgoeshere","auth": "","identitytoken": "" },"tls": null } },"auths": null,"headers": null },
As a test I first applied the following manifest to k3s
apiVersion: v1kind: Podmetadata: name: troubleshootingspec: containers: - name: troubleshooter imagePullPolicy: Always image: docker.io/mydockerprouser/troubleshooting:v1 command: [ "/bin/bash", "-c", "--" ] args: [ "while :; do echo -n '.'; sleep 5 ; done" ]
From kubectl describe pod troubleshooting
I see this error
Warning Failed 60m (x4 over 61m) kubelet Failed to pull image "docker.io/mydockerprouser/troubleshooting:v1": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/mydockerprouser/troubleshooting:v1": failed to unpack image on snapshotter overlayfs: unexpected media type text/html for sha256:7204e99bfb31a747dccaaac6d3e1599b008efa7cc31c2834b2623d2fba3a9c6a: not found
For a second test I ran sudo k3s crictl pull --creds docker.io/mydockerprouser/troubleshooting:v1
And I get
E0223 17:02:19.602354 7373 remote_image.go:171] "PullImage from image service failed" err="rpc error: code = NotFound desc = failed to pull and unpack image \"docker.io/mydockerprouser/troubleshooting:v1\": failed to unpack image on snapshotter overlayfs: unexpected media typetext/html for sha256:7060d74a8a8262817c2e5378288e2c2ba200e060c53e090bc7831c67de4cfafb: not found" image="docker.io/mydockerprouser/troubleshooting:v1"FATA[0000] pulling image: rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/mydockerprouser/troubleshooting:v1": failed to unpack image on snapshotter overlayfs: unexpected media type text/html for sha256:7060d74a8a8262817c2e5378288e2c2ba200e060c53e090bc7831c67de4cfafb: not found
If I remove the registries.yaml and run
sudo k3s crictl pull --creds "mydockerprouser:dckr_pat_randomstuffgoeshere" docker.io/mydockerprouser/troubleshooting:v1
It works!
Additional information
- Running K3s on fedora-coreos
- K3s version v1.26.1+k3s1