我用 k3d create && k3d start
开始了 k3d .
所有 pod 都无法启动,并出现以下错误:
Warning FailedCreatePodSandBox 14s (x2 over 31s) kubelet, k3d-k3s-default-server Failed to create pod sandbox: rpc error: code = Unknown desc = failed to get sandbox image "docker.io/rancher/pause:3.1": failed to pull image "docker.io/rancher/pause:3.1": failed to pull and unpack image "docker.io/rancher/pause:3.1": 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
如 recommended by a k3d contributor ,我已经执行到 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
在宿主环境中,
docker pull docker.io/rancher/pause:3.1
工作得很好。我看到很多人通过调整各种 DNS 设置来解决这个问题。但没有人描述他们是如何找到他们的特定解决方案的。
解决这个问题会让我高兴。发现一个通用的诊断策略会让我更快乐。
什么没有奏效
来自 here :
I got the issue. I had one entry in /etc/systemd/network/en0.networking Deleted that file, and everything is fine.
我在
/etc/systemd/network/
中没有文件.
最佳答案
我遇到了同样的问题,k3s 无法拉取图像并通过更新我的 /etc/resolv.conf
解决了这个问题。来自 /run/systemd/resolve/stub-resolv.conf
的符号链接(symbolic link)在主机上
ln -sf /etc/resolv.conf /run/systemd/resolve/stub-resolv.conf
关于docker - k3d 拉取镜像失败 "docker.io/rancher/pause:3.1",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61325361/