ServiceMonitor for Prometheus Node Exporter Not Applying EC2 Instance Labels in Kubernetes

I’m using the kube-prometheus-stack Helm chart to deploy Prometheus and configure ServiceMonitors for monitoring EC2 instances with the Node Exporter. I have configured the ServiceMonitor to relabel EC2 instance tags, but the instance label is not being applied as expected.

I have verified the following:

  • EC2 instances have the required tags.

  • IAM roles and permissions are correctly set up.

  • ServiceMonitor and Prometheus configurations include the required relabeling rules.

    Configuration:

    prometheus-node-exporter:
      resources:
        requests:
          memory: "64Mi"
          cpu: "100m"
      service:
        annotations:
          service.kubernetes.io/topology-aware-hints: Auto
          service.kubernetes.io/topology-aware-routing: Auto
      extraArgs:
        - --collector.ethtool
      nodeSelector:
        kubernetes.io/os: linux
      rbac:
        pspEnabled: false
      serviceMonitor:
        enabled: true
        interval: 30s
        jobLabel: node-exporter
        metricRelabelings: []
        relabelings:
          - sourceLabels: [__meta_ec2_tag_Name]
            action: replace
            targetLabel: instance
          - sourceLabels: [__address__]
            action: replace
            targetLabel: __address__
      prometheus:
        monitor:
          relabelings:
            - sourceLabels: [__meta_ec2_tag_Name]
              action: replace
              targetLabel: instance
            - sourceLabels: [__address__]
              action: replace
              targetLabel: __address__
    
    

    However, the relabeling for the instance label does not seem to be working. Below is the output of a dry run for the ServiceMonitor:

    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
      name: monitoring-prometheus-node-exporter
      namespace: monitoring
      labels:
        helm.sh/chart: prometheus-node-exporter-4.34.0
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/component: metrics
        app.kubernetes.io/part-of: prometheus-node-exporter
        app.kubernetes.io/name: prometheus-node-exporter
        app.kubernetes.io/instance: monitoring
        app.kubernetes.io/version: "1.8.0"
        jobLabel: node-exporter
        release: monitoring
    spec:
      jobLabel: node-exporter
      selector:
        matchLabels:
          app.kubernetes.io/name: prometheus-node-exporter
          app.kubernetes.io/instance: monitoring
      attachMetadata:
        node: false
      endpoints:
        - port: http-metrics
          scheme: http
          relabelings:
            - action: replace
              sourceLabels:
              - __meta_ec2_tag_Name
              targetLabel: instance
            - action: replace
              sourceLabels:
              - __address__
              targetLabel: __address__
    
    

    Despite this configuration, the instance label does not appear in the Prometheus UI for the targets.

    I expected the instance label to be populated with the EC2 tag Name for each target monitored by the ServiceMonitor. However, this is not happening, and the label is not present in the target list in the Prometheus UI.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật