docker容器,磁盤掛載顯示掛載了/etc/hosts,/etc/hostname,/etc/resolv.conf


背景:

1.通過docker安裝了node-exporter,從指標中發現磁盤掛載信息多出了幾條無用信息

node_filesystem_avail_bytes{device="/dev/vda1",fstype="ext4",mountpoint="/"} 2.4349609984e+10
node_filesystem_avail_bytes{device="/dev/vda1",fstype="rootfs",mountpoint="/etc/hosts"} 2.4349609984e+10 
node_filesystem_avail_bytes{device="/dev/vda1",fstype="tmpfs",mountpoint="/etc/hostname"} 9.63887104e+08
node_filesystem_avail_bytes{device="/dev/vda1",fstype="tmpfs",mountpoint="/etc/resolv.conf"} 1.92897024e+08

2.進入node-exporter容器,通過df -hT 同樣可以看到掛載信息

 

 

原因:

/etc/hosts,/etc/hostname,/etc/resolv.conf的內容是跟環境相關的,從宿主機(或docker)掛載到容器,會進行動態變更處理。

所以,可以認為是docker的一種機制,並且是合理的(深層原因有待考究)。

 

解決辦法:

在grafana監控頁面,顯示文件系統內容是,把這個3個mountpoint過濾即可

 

參考:

https://cloud.tencent.com/developer/ask/223627


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM