do i need kubernertes-cadvisor up to monitor kubernetes

1/14/2019

I've setup Prometheus to monitor Kubernetes. However when i watch the Prometheus dashboard I see kubernetes-cadvisor DOWN

I would want to know if we need it to monitor Kubernetes because on Grafana i already get different information as memory usage, disk space ...

Would it be used to monitor containers in order to make precise requests such as the use of memory used by a pod of a specific namespace?

-- morla
grafana
kubernetes
prometheus

2 Answers

1/22/2019

To get the metrics of container we need CADVISOR !!

to setup it i just follow the procedure below

https://github.com/google/cadvisor

i installed it on each of my nodes ! i run on each

sudo docker run \
  --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 \
  --publish=8080:8080 \
  --detach=true \
  --name=cadvisor \
  google/cadvisor:latest

i hope this will help you guys ;)

-- morla
Source: StackOverflow

1/14/2019

The error you have provided means that the cAdvisor's content does not comply with the Prometheus exposition format.[1] But to be honest, it is one of the possibilities and as you did not provide more information we will have to leave it for now (I mean the information asked by Oliver + versions of Prometheus and Grafana and environment in which you are running the cluster).

Answering your question, although you don't need to use cAdvisor for monitoring, it does provide some important metrics and is pretty well integrated with Kubernetes. So until you need container level metrics, then you should use cAdvisor. As specified in this article(you can find configuration tutorial there):

you can’t access cAdvisor directly (through 4194). You can (!) access cAdvisor by duplicating the job_name (called “k8s”) in the prometheus.yml file, calling the copy “cAdvisor” (perhaps) and inserting an additional line to define “metrics_path”. Prometheus assumes exporters are on “/metrics” but, for cAdvisor, our metrics are on “/metrics/cadvisor”.

I think that could be the reason, but if this does not solve your issue I will try to recreate it in my cluster.

Update:

Judging from your yaml file, you did not configure Prometheus to scrape metrics from the cAdvisor. Add this to your yaml file:

scrape_configs:
- job_name: cadvisor
  scrape_interval: 5s
  static_configs:
  - targets:
    - cadvisor:8080

As specified here.

-- aurelius
Source: StackOverflow