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

Viewed 2475

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?

1 Answers

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.

Related