负载报告服务 (LRS)
负载报告服务提供了一种机制,使 Envoy 可以定期向管理服务器发出负载报告。
这将启动与管理服务器的双向流。连接后,管理服务器可以发送 LoadStatsResponse 到它想要获取负载报告的节点。该节点中的 Envoy 将开始发送 LoadStatsRequest。这是根据 负载报告间隔 定期执行的。
具有 LRS 的 Envoy 配置示例
1static_resources:
2 listeners:
3 - address:
4 socket_address:
5 address: 0.0.0.0
6 port_value: 80
7 filter_chains:
8 - filters:
9 - name: envoy.filters.network.http_connection_manager
10 typed_config:
11 "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
12 codec_type: AUTO
13 stat_prefix: ingress_http
14 route_config:
15 name: local_route
16 virtual_hosts:
17 - name: service
18 domains:
19 - "*"
20 routes:
21 - match:
22 prefix: "/service"
23 route:
24 cluster: local_service
25 http_filters:
26 - name: envoy.filters.http.router
27 typed_config:
28 "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
29 clusters:
30 - name: local_service
31 type: STRICT_DNS
32 lb_policy: ROUND_ROBIN
33 load_assignment:
34 cluster_name: local_service
35 endpoints:
36 - lb_endpoints:
37 - endpoint:
38 address:
39 socket_address:
40 address: http_service
41 port_value: 8080
42 - name: load_reporting_cluster
43 type: STRICT_DNS
44 lb_policy: ROUND_ROBIN
45 typed_extension_protocol_options:
46 envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
47 "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
48 explicit_http_config:
49 http2_protocol_options: {}
50 load_assignment:
51 cluster_name: load_reporting_cluster
52 endpoints:
53 - lb_endpoints:
54 - endpoint:
55 address:
56 socket_address:
57 address: lrs_server
58 port_value: 18000
59cluster_manager:
60 load_stats_config:
61 api_type: GRPC
62 grpc_services:
63 - envoy_grpc:
64 cluster_name: load_reporting_cluster
65admin:
66 address:
67 socket_address:
68 address: 0.0.0.0
69 port_value: 8081