kubernetes / kube-state-metrics

Add-on agent to generate and expose cluster-level metrics.
https://kubernetes.io/docs/concepts/cluster-administration/kube-state-metrics/
Apache License 2.0
5.45k stars 2.02k forks source link

Helm Chart || ServiceMonitor || support of attachMetadata: node #2557

Open PowerSurj opened 5 days ago

PowerSurj commented 5 days ago

What would you like to be added: Capability to add node metadata e.g. node labels

Why is this needed: it would enable filtering of node metrics through node labels

Describe the solution you'd like in servicemonitor.yaml include additional templating that can results with below

spec:
  attachMetadata:
    node: true

as for example see node-exporter https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus-node-exporter/templates/servicemonitor.yaml

  {{- with .Values.prometheus.monitor.attachMetadata }}
  attachMetadata:
    {{- toYaml . | nindent 4 }}
  {{- end }}

we could then add node labels to kube_node_info

k8s-ci-robot commented 5 days ago

This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.