我正在尝试使用普罗米修斯从15090端口的Istio特使抓取数据。
我当前的设置是使用带有独立prometheus的istio 1.1.5(不是istio附带的软件)
特使边车连接到不同命名空间中的多个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.
答案 0 :(得分: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