Skip to content

kubelet: Unable to fetch container log stats: failed to get fsstats when container restart #453

@novahe

Description

@novahe

What happened?

Kebelet continues to display "Unable to fetch container log stats" errors trying to access missing logs of docker containers.
I'm not sure what is the mechanism here, while it seems that if somehow the container is not recycled by kebelet, the dangling link to the deleted container is not handled, triggering the file not found error.

cri_stats_provider.go:694] "Unable to fetch container log stats" err="failed to get fsstats for \"/var/log/pods/kube-system_kube-scheduler-xxx_4xxxe/kube-scheduler/15.log\": no such file or directory" containerName="kube-scheduler"
cri_stats_provider.go:694] "Unable to fetch container log stats" err="failed to get fsstats for \"/var/log/pods/kube-system_kube-apiserver-xxx_xxx/kube-apiserver/29.log\": no such file or directory" containerName="kube-apiserver"
cri_stats_provider.go:694] "Unable to fetch container log stats" err="failed to get fsstats for \"/var/log/pods/kube-system_etcd-xxx_0x9/etcd/18.log\": no such file or directory" containerName="etcd"

What did you expect to happen?

automatically remove missing logs

How can we reproduce it (as minimally and precisely as possible)?

Started with kubeadm init --cri-socket unix:///var/run/cri-dockerd.sock.
Remove any exited container from docker
Then "Unable to fetch container log stats" error will be triggered

xref: kubernetes/kubernetes#123231

version:
cri-dockerd v0.3.16
k8s v1.31.1
docker 1.27.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions