You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kubernetes GC磁盘使用检测机制及分盘节点监测对象问询

Kubernetes Image GC: Disk Usage Monitoring Explained

Hey there, let's unpack your questions about Kubernetes image garbage collection (GC) and disk monitoring—super common points of confusion, so great to ask!

1. How does Kubernetes GC detect disk usage?

  • The image GC process is managed entirely by the kubelet running on each node. It doesn't scan every disk on the node blindly; instead, it zeroes in on the filesystem where your container runtime stores images and container data.
  • By default, this path is /var/lib/docker for Docker, or /var/lib/containerd for containerd (if you've customized your runtime's storage location, it'll target that path instead).
  • The kubelet uses two key thresholds to trigger and stop GC:
    • image-gc-high-threshold: When the target filesystem's usage exceeds this percentage (default 85%), the kubelet starts pruning unused images (those not referenced by any running or pending pod).
    • image-gc-low-threshold: GC will pause once the filesystem's usage drops to this percentage (default 80%).
  • To check the exact thresholds configured on your node, you can run this quick command:
    kubelet --help | grep -A2 image-gc
    

2. Which disk does Kubernetes monitor when /var/lib/docker is mounted on a separate volume?

  • This is such a good question—lots of folks mix this up! In your setup where /var/lib/docker is mounted to a 100GB disk (while the root / is only 20GB), the kubelet will monitor the disk hosting /var/lib/docker, not the root filesystem.
  • The logic here makes sense: all the heavy stuff—image layers, container writable layers, and runtime metadata—lives in that mounted volume. The root filesystem's usage (which you noted doesn't change much) isn't tied to image storage, so it doesn't factor into image GC decisions.
  • If you want to double-check which filesystem the kubelet is watching, you can either:
    • Check the kubelet logs (look for lines referencing "image garbage collection" or "disk usage for image storage")
    • Run this command to see the stats for the /var/lib/docker mount:
      df -h /var/lib/docker
      

内容的提问来源于stack exchange,提问作者magicaltrout

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:42:39