kube-prometheus icon indicating copy to clipboard operation
kube-prometheus copied to clipboard

kube-state-metrics cant get node label

Open Ryu-Z opened this issue 1 year ago • 4 comments

kube-state-metrics cant get node label

when i use kube-prometheus, i cant get node label from metrics: kube_node_labels{job="kube-state-metrics"}

imgae

image: k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.6.0

args

args:
  - --host=127.0.0.1
  - --port=8081
  - --telemetry-host=127.0.0.1
  - --telemetry-port=8082

clusterRole

...
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  - secrets
  - nodes
  - pods
  - services
  - serviceaccounts
  - resourcequotas
  - replicationcontrollers
  - limitranges
  - persistentvolumeclaims
  - persistentvolumes
  - namespaces
  - endpoints
  verbs:
  - list
  - watch
...

prometheus sql

kube_node_labels{job="kube-state-metrics"}

i got

...
kube_node_labels{node="ip-10-162-123-166.ap-northeast-1.compute.internal"} 1
...

Ryu-Z avatar Oct 18 '22 04:10 Ryu-Z

I also encountered the same problem. I could not get indicators such as label_alpha_eksctl_io_cluster_name. However, when I looked at the label of node in the cluster, all of them were available. For node, it seems that only node IP, instance, job, and container information can be obtained

lign0 avatar Jan 14 '23 23:01 lign0

The current version is 0.11, which uses the default configuration of the project and only changes the node selector in namespace and env. Does anyone know the reason for this? I've been doing some research, kubernetes mentions Flags --metric-blacklist and --metric-whitelist were renamed to --metric-denylist and --metric-allowlist.--metric-labels-allowlist allows you to specify a list of Kubernetes labels that get turned into the dimensions of the kube_< resource-name> _labels metrics. By default, the metric contains only name and namespace labels. i have try the setting, but kube_node_labels still has the same label. Pls help

lign0 avatar Jan 16 '23 05:01 lign0

according to - https://github.com/kubernetes/kube-state-metrics/issues/1716 this is the correct value which seem to work

kube-state-metrics.extraArgs: - --metric-labels-allowlist=nodes=[*]

bigman3 avatar Feb 05 '23 11:02 bigman3

I would be interested in that to. These information are necessary to for example create a metric of which instance types are deployed and how many cores have been given to them.

I would expect labels to be shown like here: https://github.com/kubernetes/kube-state-metrics/issues/2009

rgarcia89 avatar Mar 09 '23 10:03 rgarcia89