Envoy
Envoy Proxy
A cloud-native proxy. The data plane of Istio.
Envoy Proxy
A cloud-native proxy. The data plane of Istio.
Envoy is a high-performance L7 (application layer) proxy developed at Lyft and is now a CNCF graduated project. It handles service-to-service communication in microservice architectures and is widely used as the data plane of service meshes such as Istio and AWS App Mesh.
# envoy.yaml - HTTP 리버스 프록시 설정
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 8080
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: ingress_http
codec_type: AUTO
route_config:
name: local_route
virtual_hosts:
- name: backend
domains: ["*"]
routes:
# API 라우트
- match:
prefix: "/api/"
route:
cluster: api_service
timeout: 30s
# 정적 파일
- match:
prefix: "/"
route:
cluster: frontend_service
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
clusters:
- name: api_service
connect_timeout: 5s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: api_service
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: api-server
port_value: 3000
# 헬스체크
health_checks:
- timeout: 3s
interval: 10s
unhealthy_threshold: 3
healthy_threshold: 2
http_health_check:
path: /health
# 서킷 브레이커
circuit_breakers:
thresholds:
- priority: DEFAULT
max_connections: 1000
max_pending_requests: 1000
max_requests: 1000
max_retries: 3
- name: frontend_service
connect_timeout: 5s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: frontend_service
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: frontend
port_value: 80
admin:
address:
socket_address:
address: 0.0.0.0
port_value: 9901
# Rate limit 필터 설정
http_filters:
- name: envoy.filters.http.ratelimit
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit
domain: my_domain
stage: 0
rate_limit_service:
grpc_service:
envoy_grpc:
cluster_name: ratelimit_service
transport_api_version: V3
- name: envoy.filters.http.router
# Route level rate limit
routes:
- match:
prefix: "/api/"
route:
cluster: api_service
rate_limits:
- actions:
- request_headers:
header_name: "x-api-key"
descriptor_key: "api_key"
# TLS 리스너 설정
filter_chains:
- filter_chain_match: {}
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
require_client_certificate: true
common_tls_context:
tls_certificates:
- certificate_chain:
filename: /etc/certs/server.crt
private_key:
filename: /etc/certs/server.key
validation_context:
trusted_ca:
filename: /etc/certs/ca.crt
Envoy YAML configuration is very complex. Rather than writing it by hand, use higher-level tools such as Istio or Contour, or use an xDS control plane.
Deploying with the sidecar pattern requires additional memory/CPU per pod. Plan resources carefully in large clusters.
Adding a proxy layer makes debugging network problems more complex. Learn how to use the Envoy admin API and detailed logging.
Watch the xDS API version (v2, v3). Recent Envoy versions may not support v2.