美文网首页
K3s使用Containerd运行时拉取镜像失败

K3s使用Containerd运行时拉取镜像失败

作者: shuhanghang | 来源:发表于2022-03-11 00:33 被阅读0次

    问题:

    [root@master1 ~]# crictl pull nginx
    FATA[0002] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:latest": failed to resolve reference "docker.io/library/nginx:latest": failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/latest": proxyconnect tcp: dial tcp: lookup http: Try again
    [root@master1 ~]# crictl pull tomcat:7
    FATA[0017] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/tomcat:7": failed to copy: httpReadSeeker: failed open: failed to do request: Get "https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/9d/9dfd74e6bc2f5a477649be71bec187dce1c04cccecaca286d5e6604e9f8d2afc/data?verify=1646929148-foDmuKu%2BLtZqrhU47yfjG0os71w%3D": net/http: TLS handshake timeout
    [root@master1 ~]# crictl pull tomcat:7
    FATA[0001] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/tomcat:7": failed to resolve reference "docker.io/library/tomcat:7": failed to authorize: failed to fetch anonymous token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Ftomcat%3Apull&service=registry.docker.io": EOF
    

    为什么:
    代理网络不稳定、dockerhub拉取次数限制等。通常是由于事先设置代理环境变量,在方便拉取镜像或文件的同时,如果出现该问题请检查容器运行时使用的代理配置。

    使用curl -sL https://get.k3s.io | sh - 脚本在下载k3s后创建服务时会读取预先设置的代理环境变量并写入到env文件然后配置服务: EnvironmentFile=-/etc/systemd/system/k3s.service.env ,而在k3s服务启动时该文件读入到了k3s内置的containerd运行时环境中。

    解决办法:
    多次尝试或更换代理节点、删除环境变量文件从本地直接拉取

    [root@master1 ~]# rm -rf /etc/systemd/system/k3s.service.env
    [root@master1 ~]# systemctl restart k3s
    

    相关文章

      网友评论

          本文标题:K3s使用Containerd运行时拉取镜像失败

          本文链接:https://www.haomeiwen.com/subject/mbuqdrtx.html