Error: failed to start container "node-exporter": Error response from daemon: path /sys is mounted on /sys but it is not a shared or slave mount
shows that message here is the repository I took it from trying to make a node exporter to Grafana dashboard through Kubernetes pods followed this video and this repo
ERROR screenshot
3
Answers
Well for me (Docker-Desktop in MacOS) this command saved my day:
credit: GitHub Issues
This work for me (Docker-Dektop in MacOs m1)
What is the issue
This is not an issue of node exporter or helm chart or Kubernetes or docker but a limitation of docker desktop. Only people using Kubernetes on the docker desktop should be the ones facing the issue.
Take a look at the values.yaml from prometheus-node-exporter
It is using mount propagation. Now, take a look at the docker documentation::
furthermore, and the most important one:
Okay but tell me how to solve it
You can turn off the hostRootFsMount, of course, by using the
kubectl patch
as suggested by Ali’s answer, or you can useI am using kube-prometheus-stack chart in my case, and it contains the dependency of node exporter with the name
prometheus-node-exporter
, thus the first line of the yaml containsprometheus-node-exporter
, and it can be different if the name of the dependency is different for the chart you are using.If you are using the prometheus-node-exporter chart directly, then you can install it with
--set hostRootFsMount.enabled=false
BUT
Bear in mind that by disabling mount propagation node-exporter won’t be able to collect all data needed for grafana dashboards and for alerts. — paulfantom [maintainer]
So, what does this mean?
It means this is a workaround and not a solution. There are side effects to it. But on the bright side, this is a docker desktop issue. Prometheus should work fine on your production clusters. But if you are using docker desktop as your production env, then you need to reconsider some of your life choices. Have a nice day! 🙂