google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
17.02k stars 2.31k forks source link

container_fs_usage_bytes metrics miss pod/container label #3495

Open tripitakav opened 7 months ago

tripitakav commented 7 months ago

kubectl version: v1.24.15-eks contained: 1.6.19

chengjoey commented 6 months ago

https://github.com/google/cadvisor/blob/570d8a7eea0a7669d0a1d024190010a200bbef7b/container/containerd/handler.go#L174-L185

containerd not support fs disk usage yet

chengjoey commented 6 months ago

when use containerd cri, we could get mountinfo from proc/self/mountinfo like this:

2826 28 0:478 / /run/containerd/io.containerd.runtime.v2.task/k8s.io/02f14690a20e38c89d9f1c251b2b043c542e49d9aa62baa3408fb3e51d369819/rootfs rw,relatime shared:811 - overlay overlay rw,lowerdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/66230/fs:/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/66153/fs:/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/66152/fs:/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/66151/fs:/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/59780/fs,upperdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/66239/fs,workdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/66239/work,index=off

Therefore, when we query the disk usage of contianerd, we can use this directory/run/containerd/io.containerd.runtime.v2.task/k8s.io/02f14690a20e38c89d9f1c251b2b043c542e49d9aa62baa3408fb3e51d369819/rootfs

chengjoey commented 6 months ago

get disk usage by containerd rootfs: image

chengjoey commented 6 months ago

3502