Search code examples
kubernetesprometheusgrafanaazure-aksprometheus-node-exporter

Prometheus change all nodenames to lowercase


I've installed via Helm kube-prometheus-stack from prometheus-community repository. Everything works fine but I got a problem with node/host names.

I'm using AKS with one node pool and 8 nodes. An example node hostname is: aks-nodepool-0000A. When I use command kubectl get nodes I can see that the node name is a little bit different because it's written in lowercase, for example aks-nodepool-0000a.

So that makes problem with metrics because some metrics are using lowercase node name like kube_node_status_capacity{node="$node",resource="cpu"} and other metrics are with uppercase last letter, for example this one: node_uname_info{nodename="$node"}).

This makes really a mess in my Grafana dashboards because I have to use two variables (one with lowercase and one with uppercase name).I tried to use case insensitive expression kube_node_status_capacity{node=~"(?i:($node))"},resource="cpu"} but it does not work in any query.

Is there a solution to change all nodename node values to lowercase?


Solution

  • Long time ago I asked for it on GitHub. Few days ago I got answer. Now it can be easily done via relabel_config

    GitHUb issue: https://github.com/prometheus-operator/kube-prometheus/discussions/792

    Relabel_config: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config