【问题标题】:How to scrape data from istio-envoy containers如何从 istio-envoy 容器中抓取数据
【发布时间】:2019-10-20 19:05:36
【问题描述】:

我正在尝试使用 prometheus 从 Istio envoy 的 15090 端口抓取数据。

我目前的设置是使用独立 prometheus 的 istio 1.1.5(不是 istio 附带的那个)

Envoy sidecar 附加到不同命名空间中的多个 pod,我不确定如何在多个 istio-proxy 容器中的特定端口上抓取数据

我尝试使用服务监视器从 istio envoy 抓取数据,但它不起作用。

我目前尝试的服务监视器。

kind: ServiceMonitor
metadata:
  annotations:
  labels:
    k8s-app: istio
  name: envoy
  namespace: monitoring
spec:
  endpoints:
  - interval: 5s
    path: /metrics
    port: http-envoy-prom
  jobLabel: envoy
  namespaceSelector:
    matchNames:
    - istio-system
  selector:
    matchLabels:
      istio: mixer```

can somebody help, how to scrape data from port 15090 on multiple istio-proxy containers attached to multiple pods.

【问题讨论】:

    标签: kubernetes prometheus istio


    【解决方案1】:

    除了 ServiceMonitor,您还需要为特使代理创建以下抓取配置

     # Scrape config for envoy stats
        - job_name: 'envoy-stats'
          metrics_path: /stats/prometheus
          kubernetes_sd_configs:
          - role: pod
          relabel_configs:
          - source_labels: [__meta_kubernetes_pod_container_port_name]
            action: keep
            regex: '.*-envoy-prom'
          - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
            action: replace
            regex: ([^:]+)(?::\d+)?;(\d+)
            replacement: $1:15090
            target_label: __address__
          - action: labelmap
            regex: __meta_kubernetes_pod_label_(.+)
          - source_labels: [__meta_kubernetes_namespace]
            action: replace
            target_label: namespace
          - source_labels: [__meta_kubernetes_pod_name]
            action: replace
            target_label: pod_name
          metric_relabel_configs:
          # Exclude some of the envoy metrics that have massive cardinality
          # This list may need to be pruned further moving forward, as informed
          # by performance and scalability testing.
          - source_labels: [ cluster_name ]
            regex: '(outbound|inbound|prometheus_stats).*'
            action: drop
          - source_labels: [ tcp_prefix ]
            regex: '(outbound|inbound|prometheus_stats).*'
            action: drop
          - source_labels: [ listener_address ]
            regex: '(.+)'
            action: drop
          - source_labels: [ http_conn_manager_listener_prefix ]
            regex: '(.+)'
            action: drop
          - source_labels: [ http_conn_manager_prefix ]
            regex: '(.+)'
            action: drop
          - source_labels: [ __name__ ]
            regex: 'envoy_tls.*'
            action: drop
          - source_labels: [ __name__ ]
            regex: 'envoy_tcp_downstream.*'
            action: drop
          - source_labels: [ __name__ ]
            regex: 'envoy_http_(stats|admin).*'
            action: drop
          - source_labels: [ __name__ ]
            regex: 'envoy_cluster_(lb|retry|bind|internal|max|original).*'
            action: drop
    

    或者使用这个script

    【讨论】:

      猜你喜欢
      • 2021-07-01
      • 2022-01-15
      • 1970-01-01
      • 2020-08-25
      • 1970-01-01
      • 1970-01-01
      • 2020-08-09
      • 2023-03-09
      • 2021-05-28
      相关资源
      最近更新 更多