ImagePullBackOff
错误信息
失败到 拉取镜像: 后面-off pulling 镜像
快速摘要
cluster cannot download specified 镜像从 registry, 通常 due 到认证, network, or 镜像 name issues.
为什么发生
镜像做 不 exist in specified registry
registry 需要认证但 否 imagePullSecret 是配置
registry 是 unreachable due 到 network issues or firewall 规则
镜像 name or 标签是 misspelled
最小示例
# No imagePullSecret configured for private registry
image: registry.example.com/myapp:v1# Create and reference imagePullSecret
kubectl create secret docker-registry regcred \
--docker-server=registry.example.com \
--docker-username=user \
--docker-password=pass
# In Pod spec:
imagePullSecrets:
- name: regcred私有 registry 需要认证. fix 创建 secret 使用 credentials and 引用它 in Pod spec.
如何诊断
检查 Pod 状态:
kubectl 获取 pods— look for ImagePullBackOff描述 Pod for detailed 错误:
kubectl 描述 pod <pod>Try pulling 镜像 manually:
docker 拉取 <镜像>验证 imagePullSecrets 是配置:
kubectl 获取 secrets
如何修复
正确镜像 name and 标签 in 部署 manifest
创建 imagePullSecret and 添加它 到 Pod spec
Fix network connectivity 到 registry (检查 DNS, firewall, proxy)
Ensure 镜像有 是构建 and pushed 到 registry
如何预防
Use CI/CD 到 automatically 构建 and 推送镜像
配置 imagePullSecrets for 私有 registries in 每个命名空间
Use explicit 镜像标签相反的
latest