最近更新时间:2023.09.05 19:43:48
首次发布时间:2023.09.05 19:43:48
Pod(容器组) 长时间处于 ImagePullBackOff 状态。
如果 Pod 处于 ImagePullBackOff 状态,说明 Pod 已被成功调度,但是拉取容器镜像失败。可能的原因如下:
latest
时,请确认镜像仓库中存在版本为latest
的镜像。docker pull <imange-name>
若 Pod 拉取了私有镜像。但未配置 imagePullSecret、配置的 Secret 不存在或者有误都会造成认证失败,造成 Pod 一直处于 ImagePullBackOff 状态。查看 Pod 的事件信息,会显示401 Unauthorized
事件。
解决方法:配置 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 本身的限制所致。默认情况下,kubelet 支持串行下载镜像,配置项如下所示。
--serialize-image-pulls Default: true Pull images one at a time. We recommend *not* changing the default value on nodes that run docker daemon with version < 1.9 or an Aufs storage backend. Issue #10959 has more details.
说明
pull QPS exceeded
错误不会影响到 Pod 镜像的正常下载。Pod 在队列中超时后,会重新进入下载队列,重试拉取镜像。
解决方法:为避免 Pod 拉取镜像超时,产生pull QPS exceeded
错误,您可以开启并行下载及配置并发数量,配置项如下所示。
--Registry-qps int32 Default: 5 If > 0, limit Registry pull QPS to this value. If 0, unlimited.
--Registry-burst int32 Default: 10 Maximum size of a bursty pulls, temporarily allows pulls to burst to this number, while still not exceeding --registry-qps. Only used if --registry-qps is greater than 0.
说明
更详细的配置说明,请参见 kubelet 官方文档。