cAdvisor¶
cAdvisor (Container Advisor) is a tool used to monitor the resource usage of containers.^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]
Overview¶
cAdvisor is specifically designed to analyze and expose resource usage information from within running containers.^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]
Deployment¶
In Kubernetes environments, cAdvisor is typically deployed as a DaemonSet to ensure that it runs on every node in the cluster.^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]
Host Network Configuration¶
It is standard practice to configure the cAdvisor container with hostNetwork: true.^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md] This configuration allows the Pod to use the host's network namespace.
Storage and Data Collection¶
To perform its monitoring duties, cAdvisor requires access to specific host system directories. The following volumes are typically mounted from the host node into the container^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]:
- Root Filesystem: Mounted to
/rootfs(Read Only). - Docker Data: Mounted to
/var/lib/docker(Read Only). - System Directory: Mounted to
/sys(Read Only). - Runtime Directory: Mounted to
/var/run.
Service Port¶
cAdvisor exposes its metrics, typically via HTTP, on port 4194.^[400-devops__06-Kubernetes__k8s-paas__07.Promtheus监控k8s企业级应用.md]