gpt4 book ai didi

kubernetes - 如何从 istio-envoy 容器中抓取数据

转载 作者:行者123 更新时间:2023-12-02 11:35:23 24 4
gpt4 key购买 nike

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

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

Envoy sidecars 附加到不同命名空间中的多个 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.

最佳答案

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

 # 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

关于kubernetes - 如何从 istio-envoy 容器中抓取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56457633/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com