serviceMonitorSepc.[]endpoint.relabelconfig
https://github.com/prometheus-operator/prometheus-operator/blob/main/documentation/api.md#servicemonitorspechttps://github.com/prometheus-operator/prometheus-operator/blob/main/documentation/api.md#servicemonitorspechttps://github.com/prometheus-operator/prometheus-operator/blob/main/documentation/api.md#endpointhttps://github.com/prometheus-operator/prometheus-operator/blob/main/documentation/api.md#endpointhttps://github.com/prometheus-operator/prometheus-operator/blob/main/documentation/api.md#relabelconfighttps://github.com/prometheus-operator/prometheus-operator/blob/main/documentation/api.md#relabelconfig
来个 example
apiVersion: monitoring.coreos.com/v1kind: ServiceMonitormetadata: labels: app.kubernetes.io/component: exporter app.kubernetes.io/name: node-exporter app.kubernetes.io/part-of: kube-prometheus app.kubernetes.io/version: 1.1.2 name: node-exporter namespace: monitoringspec: endpoints: - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token interval: 15s port: https relabelings: # 这就是添加的新的 label k8scluster=cluster-172.30.3.222 - replacement: cluster-172.30.3.222 targetLabel: k8scluster - action: replace regex: (.*) replacement: $1 sourceLabels: - __meta_kubernetes_pod_node_name targetLabel: instance scheme: https tlsConfig: insecureSkipVerify: true jobLabel: app.kubernetes.io/name selector: matchLabels: app.kubernetes.io/component: exporter app.kubernetes.io/name: node-exporter app.kubernetes.io/part-of: kube-prometheus
因对 prometheus 不熟悉,才这般记录。。。。哎。。。羞羞。。。