envoy转发grpc配置Dockerfile
FROM envoyproxy/envoy:v1.20-latest COPY envoy.yaml /etc/envoy/envoy.yaml COPY feature.pb /tmp/envoy/feature.pb
envoy.yaml配置
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: grpc-listener
address:
socket_address: { address: 0.0.0.0, port_value: 51051 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: grpc_json
codec_type: AUTO
route_config:
name: local_route
virtual_hosts:
- name: gprc_services
domains: ["*"]
routes:
- name: grpc-testv2
match: { prefix: "/", grpc: {} }
route: {
cluster: grpc-testv2,
timeout: { seconds: 30 },
retry_policy: {
#retry_on: "5xx",
retry_on: "connect-failure,refused-stream,unavailable,cancelled,resource-exhausted,retriable-status-codes",
num_retries: 3,
per_try_timeout: 5s,
retry_host_predicate: [{name: "envoy.retry_host_predicates.previous_hosts"}],
host_selection_retry_max_attempts: "3",
retriable_status_codes: [503]
},
}
http_filters:
- name: envoy.filters.http.grpc_json_transcoder
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.grpc_json_transcoder.v3.GrpcJsonTranscoder
proto_descriptor: "/tmp/envoy/testv2.pb"
services: ["featureserving.FeatureService"]
print_options:
add_whitespace: true
always_print_primitive_fields: true
always_print_enums_as_ints: false
preserve_proto_field_names: false
- name: envoy.filters.http.router
clusters:
- name: grpc-testv2
connect_timeout: 3s
type: logical_dns
lb_policy: round_robin
dns_lookup_family: V4_ONLY
http2_protocol_options:
max_concurrent_streams: 300
upstream_connection_options:
tcp_keepalive:
keepalive_time: 300
common_http_protocol_options:
idle_timeout: 340s
load_assignment:
cluster_name: grpc-testv2
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: test-grpc-xxxxxxxxxxx.test
port_value: 9102


请登录之后再进行评论