デバッグメモ
コンテナ単位のリソース状況を確認したくて、kubernetes/dockerのリソースモニタリングツール cAdvisor を実行したところ、以下のエラーとなり起動できなかった。
Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory
ちなみにdocker runコマンドは以下
sudo docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=8080:8080 \
--privileged=true \
--volume=/cgroup:/cgroup:ro \
google/cadvisor:latest
参考)
https://github.com/google/cadvisor
そこで、stackoverflowの以下トピックを参照し解決
https://github.com/google/cadvisor/issues/1444
https://github.com/kubernetes/kubernetes/issues/32728#issuecomment-252469277
Short synopsis from the linked issue - the cgroup is mounted under cpuacct,cpu inside a container, but the host mounts it as cpu,cpuacct. libcontainer returns the first viable candidate it finds - mrunal and vish were discussing changing libcontainer to return all of them and letting cadvisor have more info to pick the right one to look at for the host.
どうやらマウントの仕方の問題らしい。
ホストで以下のコマンドを実行することで、正常にcAdvisorを起動できるようになった
sudo mount -o remount,rw '/sys/fs/cgroup'
sudo ln -s /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/cpuacct,cpu