背景

Kubernetes1.26.1,并使用containerd作为容器运行时,准备部署一个nginx应用,发现apply后pod部署失败,kubectl describe pod nginx-deployment-699bfcdcb6-sm6b7查看pod信息发现如下信息

 Warning  Failed     49m (x4 over 51m)     kubelet            Failed to pull image "nginx:1.7.9": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:1.7.9": httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/nginx/manifests/sha256:e3456c851a152494c3e4ff5fcc26f240206abac0c9d794affb40e0714846c451: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

原因

连接镜像仓库失败,拉取镜像失败
crictl pull nginx 也是报错

PullImage from image service failed

配置Containerd运行时镜像加速器

修改containerd的 /etc/containerd/config.toml配置文件

    [plugins."io.containerd.grpc.v1.cri".registry]
    #省略其他配置#
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
           endpoint = ["https://d8b3zdiw.mirror.aliyuncs.com"]

其中,registry.mirrors."docker.io"表示为docker.io配置,endpoint表示提供mirror的镜像加速服务。
需要注意containerd连接报错的是否为docker.io failed to pull and unpack image "docker.io/library/nginx:1.7.9, 如果是其他的则改为对应的仓库

其他注意事项

根据阿里云提供的镜像仓库配置方式:https://help.aliyun.com/document_detail/60750.html,配置后出现找不到CRI的情况,后续有空再研究具体原因
FATA[0000] validate service connection: CRI v1 runtime API is not implemented for endpoint "unix:///var/run/containerd/containerd.sock": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐