-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not configure a source for OOM detection, disabling OOM events #2150
Comments
maybe you need to mount /dev/kmsg into the container? |
Tried that, same outcome. Tried it RO and RW. |
Run the cadvisor container with |
@tommmlij That was working for me. |
@wongchao 我也遇到同样的问题,你解决了吗? |
Metrics flow and work without privileged, but following running instructions results in edit: well, found something. Even though compose reference mentions it, and the feature exists, it is still not merged, so swarm does not yet support |
Probably better to use --device tag to mount device into container than using privileged... |
How do I run it as privileged? I am already running it as sudo. |
@dashpole Do you think that we should add --privileged to example command of running cAdvisor in docker in https://github.com/google/cadvisor/blob/master/README.md? |
I see that issue don't appear if
|
On Docker Compose, the solution to this issue is to add the
It's no longer reported in the logs after I added this to my docker-compose file. |
For anyone having the same problem trying to get this working in docker swarm... version: "3.7"
services:
cadvisor:
image: docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock
entrypoint: ["/bin/sh","-c"]
networks:
- monitoring
deploy:
mode: global
environment:
- PARENT={{.Task.Name}}
- CHILDNAME={{.Service.Name}}_sidecar.{{.Node.ID}}.{{.Task.ID}}
- CADVISOR_VERSION=v0.37.5
command:
- |
exec docker run -i --rm --network="container:$${PARENT}" \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:ro \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--name $${CHILDNAME} \
--privileged \
--device=/dev/kmsg \
gcr.io/cadvisor/cadvisor:$${CADVISOR_VERSION} What this does is run a simple unprivileged container which has access to the docker sock of the host. It then calls docker run for cadvisor and attaches cadvisor to the same network as the currently running container. That's all it does. If the service container is stopped cause of the exec the sigterm is passed to the docker run causing both containers to be shut down cleanly and the sidecard container gets removed cause of the --rm leaving no trace. Cause the cadvisor sidecar container is attached to the service container network it can then be reached from e.g. prometheus via http://STACK_cadvisor:8080 Hope that helps anyone. |
But still not working with |
add flag |
How come that I missed that? Oh, I remember: Because neither |
fix bug added Device /dev/kmsg see google/cadvisor#2150 (comment)
Sorry to comment on this issue, but I came across it myself. I don't like starting containers So, performing the following on the host system is probably the better solution (for Docker, at least): echo "sysctl kernel.dmesg_restrict = 0" | sudo tee /etc/sysctl.d/99-cadvisor.conf
sudo sysctl -p /etc/sysctl.d/99-cadvisor.conf |
Incredible solution. The I get below error when running According to the reference docs, https://unix.stackexchange.com/questions/390184/dmesg-read-kernel-buffer-failed-permission-denied |
Glad I could provide some help! :) |
I did the steps mentioned but I got the same error as @youngzyl. But looking at other So
worked for me. |
@danilok that looks way better than what I could look up. Thanks for sharing! |
I was able to use cadvisor few hours ago. Now it is refusing to start. The only different thing I did is attach vscode to some of the docker containers. I am guessing if there are some disk access conflicts which is causing this issue and if Trying
|
Sorry for the comment on a closed issue, but I experienced the same problem. Here's a snippet from my docker-compose.yml for reference:
|
I tried all the solutions in this thread with my docker swarm stack, only the solution provided by WolfspiritM worked for me |
You don't need the full |
Unfortunately this solution does not fully work for me, when I do I decided not to configure the sidecar and just use cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /var/run/docker.sock:/var/run/docker.sock:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
deploy:
mode: global but unfortunately this solution does not solve the OOM detection problem and I can see this on the logs
I hope this helps someone and if I find a better solution I will post it here. |
rancher1.6
Ubuntu 16.04.2
4.4.0-62-generic
Docker version 17.12.1-ce, build 7390fc6
google/cadvisor:v0.32.0
volumn:
"/:/rootfs:ro",
"/var/run:/var/run:rw",
"/sys:/sys:ro",
"/var/lib/docker/:/var/lib/docker:ro",
"rancher-cni:/.r:ro"
logs:
2019/1/18 下午6:12:08W0118 10:12:08.685620 1 manager.go:349] Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or directory
The text was updated successfully, but these errors were encountered: