入门istio,envoy如今看来必不可少,花点时间了解一下吧。nginx
咱们援引一段官网的描述:架构
Envoy is an L7 proxy and communication bus designed for large modern service oriented architectures. The project was born out of the belief that: "The network should be transparent to applications. When network and application problems do occur it should be easy to determine the source of the problem."app
Envoy
是和应用服务并行运行的,透明地代理应用服务发出/接收的流量。应用服务只须要和 Envoy
通讯,无需知道其余微服务应用在哪里。Envoy
的核心是一个 L3/L4 代理,而后经过插件式的过滤器(network filters
)链条来执行 TCP/UDP 的相关任务,例如 TCP 转发,TLS 认证等工做。Envoy
内置了一个很是核心的过滤器: http_connection_manager
。http_connection_manager
自己是如此特殊和复杂,支持丰富的配置,以及自己也是过滤器架构,能够经过一系列 http 过滤器(http filters
)来实现 http协议层面的任务,例如:http路由,重定向,CORS支持等等。Envoy
支持 HTTP/1.1 和 HTTP/2,推荐使用 HTTP/2。Envoy
能够方便的支持 gRPC,特别是在负载和代理上。Envoy
服务的。Host负载均衡
这里的 Host,能够理解为由 IP, Port 惟一肯定的服务实例dom
Downstreamsocket
发送请求给 Envoy 的 Host 是 Downstream(下游),例如gRPC的 client微服务
Upstream性能
接收 Enovy 发出的请求的 Host 是Upstream(上游),例如 gRPC的 serverui
Listenerspa
Envoy 监听的一个地址,例如 ip:port, unix socket 等等
Cluster
一组功能一致的上游 Host,称为一个cluster。相似 k8s
的 Service
, nginx
的 upstream
Http Route Table
HTTP 的路由规则,例如请求的域名,Path符合什么规则,转发给哪一个 Cluster。
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 7777 }
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/" }
route: { cluster: some_service }
http_filters:
- name: envoy.router
clusters:
- name: some_service
connect_timeout: 0.25s
type: STATIC
lb_policy: ROUND_ROBIN
hosts: [{ socket_address: { address: 127.0.0.1, port_value: 8000 }}]