k8s部署后镜像下载失败,配置Containerd运行时镜像加速器

背景

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值