Kubernetes 集群 troubleshooting

发布时间 2023-10-09 15:14:14作者: beawh

Kubernetes 集群 troubleshooting – 陈少文的网站 (chenshaowen.com)

1、FailedCreatePodSandBox

  • 错误

Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:402: getting the final child's pid from pipe caused: EOF: unknown

  • 处理

清理 cache:

echo 3 > /proc/sys/vm/drop_caches

原因:内存碎片过多。

2、calico-node 不停重启 increase max user

  • 错误

runtime: failed to create new OS thread (have 11 already; errno=11),runtime: may need to increase max user processes (ulimit -u)

  • 处理

增加 ulimit 限制额度

    ulimit -u unlimited

原因:用户进程耗尽。

3、calico-node BIRD is not ready

  • 错误

Readiness probe failed: calico/node is not ready: BIRD is not ready: Error querying BIRD: unable to connect to BIRDv4 socket: dial unix /var/run/calico/bird.ctl: connect: connection refused

  • 处理

执行 ifconfig 找到当前主机 IP 绑定的网卡,例如 ens192

kubectl -n kube-system edit ds calico-node

- name: IP_AUTODETECTION_METHOD
value: can-reach=$(NODEIP)

改为

- name: IP_AUTODETECTION_METHOD
value: "interface=ens192"

原因:没有正确识别到网卡

4、Pod 创建慢

  • 错误

    Sep 11 08:23:17 node3 kubelet[1437]: E0911 08:23:17.770706 1437 kubelet_volumes.go:225] "There were many similar errors. Turn up verbosity to see them." err="orphaned pod \"10ff3c51-ebf2-47dd-b837-fd584319a754\" found, but error not a directory occurred when trying to remove the volumes dir" numErrs=10

  • 原因
  • 可能的原因之一是,创建 Pod 依赖 Secret、ConfigMap 等资源,但在当前命名空间下,这些资源不存在,导致 Kubelet 一直尝试去获取这些资源,直到超时,影响了 Pod 的创建。

  • 处理
  • 找到缺失的资源,创建之。