You need to enable JavaScript to run this app.
容器服务

容器服务

复制全文
Pod 异常排查
Pod 处于 ImagePullBackOff 状态
复制全文
Pod 处于 ImagePullBackOff 状态

问题描述

Pod(容器组) 长时间处于 ImagePullBackOff 状态。
alt

原因分析

如果 Pod 处于 ImagePullBackOff 状态,说明 Pod 已被成功调度,但是拉取容器镜像失败。可能的原因如下:

  • 镜像地址不正确
  • 私有镜像未配置 imagePullSecret
  • 私有镜像域名配置错误
  • 镜像文件损坏
  • 镜像拉取超时

解决方法

镜像地址不正确

  1. 检查镜像地址、名称、版本的配置是否正确。其中,当版本配置为latest时,请确认镜像仓库中存在版本为latest的镜像。
    alt
  2. 执行以下命令,尝试手动拉取镜像,确认镜像地址是否正确。
    docker pull <imange-name>
    

私有镜像未配置 imagePullSecret

若 Pod 拉取了私有镜像。但未配置 imagePullSecret、配置的 Secret 不存在或者有误都会造成认证失败,造成 Pod 一直处于 ImagePullBackOff 状态。查看 Pod 的事件信息,会显示401 Unauthorized事件。
alt

解决方法:配置 imagePullSecret,实现集群中的容器免密拉取镜像,详情请参见 使用 VKE 组件内网免密拉取镜像

私有镜像域名配置错误

若 Pod 使用了私有镜像,配置了 imagePullSecrets,但 imagePullSecrets 中的域名和工作负载中的域名不一致。会导致 Pod 一直处于 ImagePullBackOff 状态。

解决方法:请参见 镜像拉取失败如何处理?

镜像文件损坏

若镜像文件损坏,下载成功后也不能正常使用,则需要重新 push 镜像文件。

镜像拉取超时

当节点上同时启动大量 Pod 时,可能会进行镜像排队下载。如果此时下载队列靠前的位置,存在许多大容量镜像且需较长的下载时间,就会导致排在队列靠后的 Pod 拉取镜像超时。此时,Pod 事件会上报pull QPS exceeded错误。错误日志示例如下。

1s          Normal    Created           pod/****-pod   Created container step-git-clone-0
1s          Normal    Started           pod/****-pod   Started container step-git-clone-0
1s          Normal    Pulling           pod/****-pod   Pulling image "cr-cn-****.volces.com/cp-system/exec-bash:v1.0.0"
1s          Normal    PullImageFailed   taskrun/****   build step "step-tos-cache-2-push" is pending with reason "pull QPS exceeded"

造成上述现象的原因是:kubelet 的serialize-image-pulls参数被配置为 串行 下载,或并发下载数量超过阈值。

说明

pull QPS exceeded错误不会影响到 Pod 镜像的正常下载。Pod 在队列中超时后,会重新进入下载队列,重试拉取镜像。

解决方法:为避免 Pod 拉取镜像超时,产生pull QPS exceeded错误,您可以开启 kubelet 的并行下载及配置并发数量。详情请参见 kubelet 自定义参数

说明

更详细的配置说明,请参见 kubelet 官方文档

最近更新时间:2024.10.28 14:47:15
这个页面对您有帮助吗?
有用
有用
无用
无用