What’s the best way to mount the host proc, sys and root filesystems for metrics gathering? I want to run Node exporter for Prometheus monitoring but I want it inside a container.
I currently have the following profile:
$ lxc profile show host-metrics
config: {}
description: ""
devices:
proc-mnt:
path: /mnt/host/proc
readonly: "true"
source: /proc
type: disk
root-mnt:
path: /mnt/host/rootfs
readonly: "true"
source: /
type: disk
sys-mnt:
path: /mnt/host/sys
readonly: "true"
source: /sys
type: disk
name: host-metrics
used_by:
- /1.0/instances/docker
On Node exporter’s github page, they mount root with rslave, but when I tried to add propagation=rslave
into the device’s configuration, the container would hot mount, but would fail to start or reboot.
Is there a better or recommended way for exposing the host’s resources inside a container?