8000 Add GRPCRoute to stable Gateway API resources · kubernetes/website@39de1a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39de1a6

Browse files
committed
Add GRPCRoute to stable Gateway API resources
1 parent 26e8609 commit 39de1a6

File tree

1 file changed

+68
-1
lines changed
  • content/en/docs/concepts/services-networking

1 file changed

+68
-1
lines changed

content/en/docs/concepts/services-networking/gateway.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The following principles shaped the design and architecture of Gateway API:
3939

4040
## Resource model
4141

42-
Gateway API has three stable API kinds:
42+
Gateway API has four stable API kinds:
4343

4444
* __GatewayClass:__ Defines a set of gateways with common configuration and managed by a controller
4545
that implements the class.
@@ -50,6 +50,10 @@ Gateway API has three stable API kinds:
5050
representation of backend network endpoints. These endpoints are often represented as a
5151
{{<glossary_tooltip text="Service" term_id="service">}}.
5252

53+
* __GRPCRoute:__ Defines gRPC-specific rules for mapping traffic from a Gateway listener to a
54+
representation of backend network endpoints. These endpoints are often represented as a
55+
{{<glossary_tooltip text="Service" term_id="service">}}.
56+
5357
Gateway API is organized into different API kinds that have interdependent relationships to support
5458
the role-oriented nature of organizations. A Gateway object is associated with exactly one GatewayClass;
5559
the GatewayClass describes the gateway controller responsible for managing Gateways of this class.
@@ -150,6 +154,69 @@ and the request path specified as `/login` will be routed to Service `example-sv
150154
See the [HTTPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.HTTPRoute)
151155
reference for a full definition of this API kind.
152156

157+
158+
### GRPCRoute {#api-kind-grpcroute}
159+
160+
The GRPCRoute kind specifies routing behavior of gRPC requests from a Gateway listener to backend network
161+
endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service
162+
IP or the backing EndpointSlices of the Service. A GRPCRoute represents configuration that is applied to the
163+
underlying Gateway implementation. For example, defining a new GRPCRoute may result in configuring additional
164+
traffic routes in a cloud load balancer or in-cluster proxy server.
165+
166+
Gateways supporting GRPCRoute are required to support HTTP/2 without an initial upgrade from HTTP/1,
167+
so gRPC traffic is guaranteed to flow properly.
168+
169+
A minimal GRPCRoute example:
170+
171+
```yaml
172+
apiVersion: gateway.networking.k8s.io/v1
173+
kind: GRPCRoute
174+
metadata:
175+
name: example-grpcroute
176+
spec:
177+
parentRefs:
178+
- name: example-gateway
179+
hostnames:
180+
- "svc.example.com"
181+
rules:
182+
- backendRefs:
183+
- name: example-svc
184+
port: 50051
185+
```
186+
187+
In this example, gRPC traffic from Gateway `example-gateway` with the host set to `svc.example.com`
188+
will be directed to the service `example-svc` on port `50051` from the same namespace.
189+
190+
GRPCRoute allows matching specific gRPC services, as per the following example:
191+
192+
```yaml
193+
apiVersion: gateway.networking.k8s.io/v1
194+
kind: GRPCRoute
195+
metadata:
196+
name: example-grpcroute
197+
spec:
198+
parentRefs:
199+
- name: example-gateway
200+
hostnames:
201+
- "svc.example.com"
202+
rules:
203+
- matches:
204+
- method:
205+
service: com.example
206+
method: Login
207+
backendRefs:
208+
- name: foo-svc
209+
port: 50051
210+
```
211+
212+
In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules
213+
to forward the traffic to the correct backend. Since there is only one match specified,only requests
214+
for the com.example.User.Login method to svc.example.com will be forwarded.
215+
RPCs of any other method` will not be matched by this Route.
216+
217+
See the [GRPCRoute](https://gateway-api.sigs.k8s.io/reference/spec/#grpcroute)
218+
reference for a full definition of this API kind.
219+
153220
## Request flow
154221

155222
Here is a simple example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute:

0 commit comments

Comments
 (0)
0