Search code examples
kubernetesprometheusgrafanaprometheus-node-exporter

Scrape Kubernetes metadata labels using Prometheus


I have added some labels to kubernetes namespace metadata, now I want to scrape namespace as well as those labels using prometheus, Actually I am trying to create a grafana dashboard and want to categorise namespaces based on labels. I tried using kubernetes_sd_configs, I am able to get namespace but unable to get labels of those namespaces. Does anyone know of any way to scrape labels along with namespace.


Solution

  • In case somebody is also looking for answer, we can use kube-state-metrics

    It exposes kube_namespace_labels metric which has labels as well as namespace.