GRPCServer in Easegress provides robust functionality tailored to gRPC protocol interactions. With its IP filtering feature, traffic can be selectively allowed or blocked, ensuring that only desired clients can communicate with the services. Additionally, the server’s routing rules offer flexible methods to determine how each incoming request is processed and forwarded, based on host, method, headers, and other criteria.
name: server-grpc kind: GRPCServer port: 8080 --- title: The maximum number of connections allowed by gRPC Server. linkTitle: The maximum number of connections allowed by gRPC Server. weight: 7 --- --- title: Default value 10240 linkTitle: Default value 10240 weight: 7 --- maxConnections: 10240 --- title: IP Filter for all traffic under the server linkTitle: IP Filter for all traffic under the server weight: 7 --- ipFilter: blockIPs:  allowIPs:  blockByDefault: false --- title: routing rules linkTitle: routing rules weight: 7 --- rules: --- title: Rules for host matching. linkTitle: Rules for host matching. weight: 7 --- --- title: If not match, GRPCServer will check next rule. linkTitle: If not match, GRPCServer will check next rule. weight: 7 --- - host: <your-host> hostRegexp: <your-host-regexp> methods: - method: /Sale/AddProduct # Exact method match backend: sale-pipeline - methodPrefix: /IT # Matches method with the given prefix backend: it-pipeline - headers: # Matches by header - key: x-geo-country values: ["CN", "EU", "US"] - key: user-agent values: ["SaleClient/1.0.0"] matchAllHeader: false backend: header-pipeline - methodRegexp: .* # Match by regexp backend: other-pipeline --- title: more rules linkTitle: more rules weight: 7 --- - methods: ...
For an in-depth exploration of the GRPCServer settings, please refer to the GRPCServer.
- A gRPC request with method
/Sale/AddProductwill be routed to the
- Any request with a method starting with
/IT/UpdateSoftware) will be directed to the
- If a client sends a request with headers
SaleClient/1.0.0, it will be handled by the
- All other requests (due to the wildcard
methodRegexp) will be sent to the
GRPCProxy filter in Easegress serves as a specialized proxy designed for gRPC backend services. This filter facilitates both unary and streaming RPCs, ensuring seamless communication in a gRPC ecosystem.
Here’s a basic configuration of the
GRPCProxy filter that directs incoming gRPC connections to two backend servers,
name: demo-pipeline kind: Pipeline flow: - proxy filters: - kind: GRPCProxy name: proxy pools: - loadBalance: policy: roundRobin servers: - url: http://192.168.1.1:80 - url: http://192.168.1.2:80
Same as the
filtercan be configured on a pool.
- the servers of a pool can be configured dynamically via service discovery.
- when there are multiple servers in a pool, the pool can do a load balance between them.
Because gRPC does not support the http
Connect method, it does not support tunneling mode,
we provide a new load balancer
policy.forward to achieve a similar effect.
Note that each gRPC client establishes a connection with Easegress. However, Easegress may utilize a single connection when forwarding requests from various clients to a gRPC server, due to its use of HTTP2. This action could potentially disrupt some client or server applications. For instance, if the client applications are structured to directly connect to the server, and both the client and server have the ability to request a connection closure, then problems may arise once Easegress is installed between them. If the server wants to close the connection of one client, it closes the shared connection with Easegress, thus affecting other clients.
For more details about GRPCProxy filter.