k3d 无法拉取镜像“docker.io/rancher/pause:3.1”

Mic*_*haw 8 docker kubernetes k3s

我已经开始使用 k3d 了k3d create && k3d start

所有 Pod 均无法启动,并出现以下错误:

警告 FailedCreatePodSandBox 14s (x2 over 31s) kubelet, k3d-k3s-default-server 无法创建 pod 沙箱:rpc 错误:代码 = 未知 desc = 无法获取沙箱映像“docker.io/rancher/pause:3.1”:未能拉取镜像“docker.io/rancher/pause:3.1”:无法拉取和解压镜像“docker.io/rancher/pause:3.1”:无法解析引用“docker.io/rancher/pause:3.1”:无法解析做请求:头 https://registry-1.docker.io/v2/rancher/pause/manifests/3.1:拨打tcp:查找registry-1.docker.io:再试一次

根据k3d 贡献者的建议,我已执行到 k3d 服务器容器并尝试手动拉取映像:

$ docker exec -it k3d-k3s-default-server sh
/ # ctr image pull docker.io/rancher/pause:3.1
docker.io/rancher/pause:3.1: resolving      |--------------------------------------|
elapsed: 4.9 s               total:   0.0 B (0.0 B/s)
ctr: failed to resolve reference "docker.io/rancher/pause:3.1": failed to do request: Head https://registry-1.docker.io/v2/rancher/pause/manifests/3.1: dial tcp: lookup registry-1.docker.io: Try again
Run Code Online (Sandbox Code Playgroud)

在主机环境中,docker pull docker.io/rancher/pause:3.1工作得很好。

我见过很多人通过调整各种 DNS 设置来解决这个问题。但没有人描述他们如何得出特定的解决方案。

解决这个问题会让我很高兴。发现一个通用的诊断策略会让我更加高兴。

什么没起作用

这里

我明白了这个问题。我在 /etc/systemd/network/en0.networking 中有一个条目删除了该文件,一切都很好。

我的 中没有文件/etc/systemd/network/

hel*_*i77 0

我遇到了与 k3s 无法提取图像相同的问题,并通过更新我的主机上的/etc/resolv.conf符号链接来解决它/run/systemd/resolve/stub-resolv.conf

ln -sf /etc/resolv.conf /run/systemd/resolve/stub-resolv.conf
Run Code Online (Sandbox Code Playgroud)