[root@node02 ~]# kubectl descroiebe pod -n kube-system calico-node-b8w2b ... Events: Type Reason Age From Message ------------------------- Warning Unhealthy 58m (x111 over 3h12m) kubelet, node01 (combined from similar events): Liveness probe failed: Get http://localhost:9099/liveness: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Normal Pulled 43m (x36 over 3d19h) kubelet, node01 Container image "calico/node:v3.15.1" already present on machine Warning Unhealthy 8m16s (x499 over 3h43m) kubelet, node01 Liveness probe failed: Get http://localhost:9099/liveness: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Warning BackOff 3m31s (x437 over 3h3m) kubelet, node01 Back-off restarting failed container
从Event日志可以看出,是calico的健康检查没通过导致的重启,出错原因也比较明显:net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers),这个错误的含义是建立连接超时[1],并且手动在控制台执行健康检查命令,发现确实响应慢(正常环境是毫秒级别):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[root@node01 ~]# time curl -i http://localhost:9099/liveness HTTP/1.1 204 No Content Date: Tue, 15 Jun 2021 06:24:35 GMT real0m1.012s user0m0.003s sys0m0.005s [root@node01 ~]# time curl -i http://localhost:9099/liveness HTTP/1.1 204 No Content Date: Tue, 15 Jun 2021 06:24:39 GMT real0m3.014s user0m0.002s sys0m0.005s [root@node01 ~]# time curl -i http://localhost:9099/liveness real1m52.510s user0m0.002s sys0m0.013s [root@node01 ~]# time curl -i http://localhost:9099/liveness ^C
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 6754 root 20066.8g 25.1g 290100 S 700.017.32971:49 java 25214 root 200630907617999237016 S 36.80.1439:06.29 kubelet 20331 root 200319666017236424908 S 21.10.1349:56.64 dockerd
[root@node01 ~]# time curl -i http://localhost:9099/liveness HTTP/1.1204 No Content Date: Tue, 15 Jun 202114:48:38 GMT real 0m0.011s user 0m0.004s sys 0m0.004s [root@node01 ~]# time curl -i http://localhost:9099/liveness HTTP/1.1204 No Content Date: Tue, 15 Jun 202114:48:39 GMT real 0m0.010s user 0m0.001s sys 0m0.005s [root@node01 ~]# time curl -i http://localhost:9099/liveness HTTP/1.1204 No Content Date: Tue, 15 Jun 202114:48:40 GMT real 0m0.011s user 0m0.002s