Repository navigation
The authentication for the Private Registry fails. #12331
|
The pod has been in the "ContainerCreating" state. The following logs are found in /var/lib/rancher/k3s/agent/containerd/containerd.log: Based on the above content, I analyze that the login username and password are incorrect. I restarted the service with the following command, to ensure that the k3s-agent loads the correct configuration. The login credentials (username and password) for the Private Registry have been verified to be correct on the node using Docker. In summary, my question is why, when my username and password are correct (I can log in via Docker), there is an authentication failure error in the |
Replies: 9 comments
|
Containerd does not respect the wildcard entry when authenticating, only when looking for mirrors. If you want to use mirrors:
"*":
endpoint:
- "http://10.111.160.21:39435"
configs:
10.111.160.21:39435:
auth:
username: admin
password: Zbwt_123456 |
Thank you very much. Your method worked. However, another problem has arisen. In the above logs, the message "http: server gave HTTP response to HTTPS client" is something I have encountered in Docker. I just need to configure "insecure-registries" in /etc/docker/daemon.json. Do I also need to make corresponding configurations in K3s? |
|
No. The image This is covered in the k3s docs: https://docs.k3s.io/installation/private-registry#default-endpoint-fallback |
You said, "The image app-k3s-test-img:1747040141 probably does not exist on your registry", but this image actually exists because I can pull it using the following command |
|
Then something else is wrong. Check the containerd logs to see why the initial pull fails and it is trying again with https. There is nothing to fix on the K3s side. Only you have the tools to figure out what is going on with your environment, now that you know how containerd behaves. |
How to view the containerd logs? Is it through /var/lib/rancher/k3s/agent/containerd/containerd.log? |
|
Yes. You can also set CONTAINERD_LOG_LEVEL=debug or CONTAINERD_LOG_LEVEL=trace in the k3s systemd unit's env vars if you need to turn up the verbosity. |
I think I know what went wrong. It's the configuration of /etc/rancher/k3s/registries.yaml that's incorrect. I use "CONTAINERD_LOG_LEVEL=trace" and find "time="2025-05-13T11:43:07.984225786+08:00" level=debug msg="loading host directory" dir="/var/lib/rancher/k3s/agent/etc/containerd/certs.d/10.111.160.21:39435". So I view /var/lib/rancher/k3s/agent/etc/containerd/certs.d/10.111.160.21:39435 It use https. As "# File generated by k3s. DO NOT EDIT.", I did not edit this file. I edit /etc/rancher/k3s/registries.yaml. to Then and pod can run(Although I'm not entirely sure why it works now. Even though there's still an HTTPS link in Thank you very much for your help. |
|
Yeah, I guess if I'd though about it I would have remembered that you'll need to use a specific entry for that repo in the mirrors section since you have a specific entry for it in the configs section - it's existence will prevent it from trying the wildcard since it does exist. Why were you using the wildcard in the first place? You don't seem to be using your repo as a mirror for anything. |
Yes. You can also set CONTAINERD_LOG_LEVEL=debug or CONTAINERD_LOG_LEVEL=trace in the k3s systemd unit's env vars if you need to turn up the verbosity.