简体   繁体   中英

Is there a way to get the cluster name of Kubernetes in Grafana variables with prometheus data source?

I am trying to get the cluster name with a variable in Grafana and I need it to be retrieved from the prometheus data source.

I tried with label_values(kube_pod_info, cluster) and label_values(up, cluster) but it's not working for me

Any ideas how to achieve this?

You need to have a "cluster" label defined in the "kube_pod_info" metric.

To resolve this you can just use the "instance" label instead or create a "cluster" label in the Prometheus configuration using the "instance" label to map the IPs to known cluster names, for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM