google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
16.93k stars 2.31k forks source link

Stop cAdvisor from monitoring docker containers #2848

Open ncapps opened 3 years ago

ncapps commented 3 years ago

Summary We have both Kubernetes and Docker running in the same environment. cAdvisor is running as part of the kubelet binary. Kubernetes is using CRI-O as our CRI. Both /var/lib/docker and /var/lib/containers are backed by a ZFS file system.

cAdvisor is gathering metrics for the Docker CRI and executes zfs list on an interval. This operation is resource intensive. We do not need cAdvisor to gather metrics for the Docker CRI.

I would like to be able to disable gathering metrics for the Docker CRI.

iwankgb commented 3 years ago

@ncapps let me rephrase your problem to make sure that I understand what you want to achieve: you are using kubelet /metrics endpoint to collect information about containers and you do not want this endpoint to take non-kubernetes containers into consideration?

ncapps commented 3 years ago

@iwankgb Yes, that's correct

iwankgb commented 3 years ago

AFAIK recommended method is to use standalone cAdvisor rather than rely on endpoint that kubelet exposes. It would give you much more flexibility over cAdvisor configuration.

filippog commented 1 year ago

I'm in the same scenario, namely I'd like to have cadvisor collect metrics from the root cgroup and not talk to docker at all. We are rolling out cadvisor to a fleet of hosts where only a subset will be running kubelet, and at that stage I'm happy if kubelet exports metrics from docker containers.

edit: a bandaid is to pass --docker /dev/null to cadvisor so at least metrics are not augmented with extra labels, which might be undesired. Of course k8s-related containers stats are still exported (e.g. metrics from kubepods.slice, or all overlay fs stats)