kubernetes: Kubernetes node healthcheck issue (Kubelet is unable to read logs from pods)
What happened?
Kubelet is running on a worker node, an issue occurs which makes kubelet unable to read logs from pods which can be seen in any of the kube-system pods logs,
Log output in kube-system pod:
Warning ContainerGCFailed <invalid> (x1266 over 21h) kubelet failed to read podLogsRootDirectory "/var/log/pods": open /var/log/pods: input/output error
If we describe the node it shows that the kubelet is in ready status:
Type Status Reason Message
---- ------ ------ -------
MemoryPressure False KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False KubeletHasNoDiskPressure kubelet has no disk pressure
PIDPressure False KubeletHasSufficientPID kubelet has sufficient PID available
Ready True KubeletReady kubelet is posting ready status
This indicates that kubelet is running but it is reporting that it is unable to read logs from '/var/log/pods'.
What did you expect to happen?
In that scenario, the worker node is still shown as ready in kubernetes. Kubernetes should be able to detect such problem independent of infrastructure. Since we see kubernetes describe node shows the issue that kubelet is ready, then kubernetes should be aware of a problem with the node and possibly set it to NotReady in that case.
How can we reproduce it (as minimally and precisely as possible)?
This can be reproducible by having the following steps:
- Start a NFS server
- Create the
/var/log/podsdirectory and mount the NFS share - Initialize the kubernetes cluster
- To trigger the error, poweroff the NFS server
- Now see the logs of the pods and it can take few minutes to see the error logs.
Anything else we need to know?
No response
Kubernetes version
v1.21.1
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 35 (14 by maintainers)
@shelmingsong @SanjanaReddyYalla @mpochazo I don’t think there is any progress on this, eventually this issue hasn’t been accepted, at least not yet.
I still feel that the state of the node would need to change when the Kubelet detects that it is getting IOErrors when it tries to write the logs, it is a reasonable use-case (IMO) that the logs are written to a SAN/NFS/SMB storage solution that is represented as either a disk/mounted directory from linux perspective, when there is a network issue, from linux perspective the disk just disappears so Kubelet will be unable to write the log file into the designated location.
I don’t say the kubelet has to monitor file system integrity but when it tries to write somewhere on the disk and gets I/O Errors that should prompt it to change the state from “healthy” to something else.