1.应用POD 异常状态常见原因
状态 | 描述 |
Error | 启动过程中发生错误 |
NodeLost | Pod 所在节点失联 |
Unkown | Pod 所在节点失联或其他未知异常 |
Waiting | Pod 等待启动。 |
Pending | Pod 等待被调度。 |
ContainerCreating | Pod 容器正在被创建。 |
Terminating | Pod 正在被销毁。 |
CrashLoopBackOff | 容器退出,Kubelet 正在将它重启 |
InvalidImageName | 无法解析镜像名称。 |
ImageInspectError | 无法校验镜像。 |
ErrImageNeverPull | 策略禁止拉取镜像。 |
ImagePullBackOff | 正在重试拉取 |
RegistryUnavailable | 连接不到镜像中心 |
ErrImagePull | 通用的拉取镜像出错 |
CreateContainerConfigError | 不能创建 Kubelet 使用的容器配置 |
CreateContainerError | 创建容器失败 |
RunContainerError | 启动容器失败。 |
PreStartHookError | 执行 preStart hook 报错 |
PostStartHookError | 执行 postStart hook 报错 |
ContainersNotInitialized | 容器没有初始化完毕。 |
ContainersNotReady | 容器没有准备完毕。 |
ContainerCreating | 容器创建中 |
PodInitializing | Pod 初始化中 |
DockerDaemonNotReady | Docker 还没有完全启动 |
NetworkPluginNotReady | 网络插件还没有完全启动 |
2.Llinux 中断信号
Signal 状态码Value 动作Action 描述Comment
SIGHUP 1 Term Hangup detected on controlling terminal or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
SIGFPE 8 Core Floating-point exception
SIGKILL 9 Term Kill signal
SIGSEGV 11 Core Invalid memory reference
SIGPIPE 13 Term Broken pipe: write to pipe with no readers; see pipe(7)
SIGALRM 14 Term Timer signal from alarm(2)
SIGTERM 15 Term Termination signal
SIGUSR1 30,10,16 Term User-defined signal 1
SIGUSR2 31,12,17 Term User-defined signal 2
SIGCHLD 20,17,18 Ign Child stopped or terminated
SIGCONT 19,18,25 Cont Continue if stopped
SIGSTOP 17,19,23 Stop Stop process
SIGTSTP 18,20,24 Stop Stop typed at terminal
SIGTTIN 21,21,26 Stop Terminal input for background process
SIGTTOU 22,22,27 Stop Terminal output for background process
信号Signal | 状态码Value | 动作Action | 描述Comment |
SIGHUP | 1 | Term | Hangup detected on controlling terminal or death of controlling process |
SIGINT | 2 | Term | Interrupt from keyboard |
SIGQUIT | 3 | Core | Quit from keyboard |
SIGILL | 4 | Core | Illegal Instruction |
SIGABRT | 6 | Core | Abort signal from abort(3) |
SIGFPE | 8 | Core | Floating-point exception |
SIGKILL | 9 | Term | Kill signal |
SIGSEGV | 11 | Core | Invalid memory reference |
SIGPIPE | 13 | Term | Broken pipe: write to pipe with no readers; see pipe(7) |
SIGALRM | 14 | Term | Timer signal from alarm(2) |
SIGTERM | 15 | Term | Termination signal |
SIGUSR1 | 30,10,16 | Term | User-defined signal 1 |
SIGUSR2 | 31,12,17 | Term | User-defined signal 2 |
SIGCHLD | 20,17,18 | Ign | Child stopped or terminated |
SIGCONT | 19,18,25 | Cont | Continue if stopped |
SIGSTOP | 17,19,23 | Stop | Stop process |
SIGTSTP | 17,19,23 | Stop | Stop typed at terminal |
SIGTTIN | 18,20,24 | Stop | Stop Terminal input for background process |
SIGTTOU | 21,21,26 | Stop | Terminal output for background process |
3.Pod 处于 CrashLoopBackOff 状态
Pod状态 | 检查list | 排查方法 |
Pod 处于 CrashLoopBackOff 状态 | 容器进程主动退出 | 容器进程主动退出时,退出状态码通常在0 - 128之间,导致异常的原因可能是业务程序 Bug |
系统 OOM | 如果发生系统 OOM,Pod 中容器退出状态码为137,表示其被 SIGKILL 信号停止 | |
cgroup OOM | 如果是因 cgroup OOM 而停止的进程,可看到 Pod 事件下 Reason 为 OOMKilled,说明容器实际占用的内存已超过 limit | |
节点内存碎片化 | 如果节点出现内存碎片化严重、缺少大页内存问题,即使总体剩余内存较多,但仍会出现申请内存失败的情况 | |
健康检查失败 | 配置的 readinessProbe livenessProbe 不合理或者探测地址不存在 |
4.Pod 一直处于 ContainerCreating 或 Waiting 状态
Pod状态 | 检查list | 排查方法 |
Pod 一直处于 ContainerCreating 或 Waiting 状态 | Pod 配置错误 | 检查配置yaml文件 |
挂载 Volume 失败 | CSI服务不正常.或者底层网络被安全组阻止 | |
磁盘空间不足 | 启动 Pod 时会调 CRI 接口创建容器,容器运行时组件创建容器时通常会在数据目录下为新建的容器创建一些目录和文件。如果数据目录所在的磁盘空间不足,将会导致容器创建失败 | |
节点内存碎片化 | 检查 limit 设置 | |
拉取镜像失败 | 配置了错误的镜像 镜像太大 | |
CNI 网络错误 | 无法配置 Pod 网络。 无法分配 Pod IP | |
controller-manager 异常 | 查看 Master 上 kube-controller-manager 状态,异常时尝试重启。 | |
存在同名容器 | 节点上存在同名容器会导致创建 sandbox 时失败,也会导致 Pod 一直处于 ContainerCreating 或 Waiting 状态。 执行 kubectl describe pod 命令,查看 event 报错信息如下: | |
安装 docker 时未完全删除旧版本 | 安装 docker 时未完全删除旧版本 |
5.Pod 一直处于 Terminating 状态
Pod状态 | 检查list | 排查方法 |
Pod 一直处于 Terminating 状态 | 磁盘空间不足 | 磁盘空间不足 |
存在 “i” 文件属性 | i” 文件属性描述可通过 man chattr 进行查看 | |
Docker 17 版本 bug | Docker hang 住,没有任何响应。执行 kubectl describe pod <pod-name> 命令查看 event 显示如下: | |
存在 Finalizers | 若想要删除该程序所创建的资源时,则需要由创建该资源的程序进行删除前的清理,且只有清理完成并将标识从该资源的 finalizers 中移除,才可以彻底删除资源。 | |
低版本 kubelet list-watch 的 bug | 历史排查异常过程中发现,使用 v1.8.13 版本的 K8S 时,kubelet 会出现 list-watch 异常的情况。该问题会导致在删除 Pod 后,kubelet 未获取相关事件,并未真正删除,使 Pod 一直处 Terminating 状态。 | |
Dockerd 与 containerd 状态不同步 | docker 在 aufs 存储驱动下如果磁盘爆满,则可能发生内核 panic | |
Daemonset Controller Bug | K8S 中存在的 Bug 会导致 Daemonset Pod 持续 Terminating,Kubernetes 1.10 和 1.11 版本受此影响 |