问题遇到的现象和发生背景
我在k8s上部署了prometheus-operator,并且想利用node-exporter采集节点的标签,来区分不同的项目组,进而实现alert告警等功能。
于是我给节点打了一个标签:team:backend
我的相关代码是这样写的,源代码是:https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml
nodeExporter:
relabelings:
- sourceLabels: [__meta_kubernetes_pod_node_name]
separator: ;
regex: ^(.*)$
targetLabel: nodename
replacement: $1
action: replace
- sourceLabels: [__meta_kubernetes_node_labelpresent_team]
separator: ;
regex: ^(.*)$
targetLabel: team
replacement: $1
action: replace
运行结果及报错内容
运行后我发现 - sourceLabels: [__meta_kubernetes_node_labelpresent_team]这一段配置并没有生效,标签team并没有采集到,请问我的配置是有问题吗?

我的解答思路和尝试过的方法
我找了官网,但是没有说明,官网是https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config
我想要达到的结果
我想要实现node-exporter上报的数据含有team这个标签