gRPC end-to-end configuration
How end-to-end gRPC configuration works
-
To deploy the gRPC configuration, you must first enable HTTP/2 in the HTTP profile and also enable HTTP/2 support globally on server side.
-
When a client sends a gRPC request, the load balancing virtual server evaluates the gRPC traffic using policies.
-
Based on policy evaluation, the load balancing virtual server (with gRPC service bound to it) terminates the request and forwards it as a gRPC request to the back-end gRPC server.
-
Similarly, when the gRPC server responds to the client, the appliance terminates the response and forwards it as a gRPC response to the client.
Example for gRPC request sent to gRPC server
```
HEADERS (flags = END_HEADERS)
: method = POST
: scheme = http
: path = /helloworld.citrix-adc/SayHello
: authority = 10.10.10.10.:80
grpc-timeout = 15
content-type = application/grpc+proto
grpc-encoding = gzip
DATA (flags = END_STREAM)
<Length-Prefixed Message>
```
Example for gRPC response header from gRPC server to NetScaler appliance
```
HEADERS (flags = END_HEADERS)
: status = 200
Grpc-encoding= gzip
Content-type = application/grpc+proto
DATA
<Length-Prefixed Message>
HEADERS (flags = END_STREAM, END_HEADERS)
grpc-status = 0 # OK
```
Configure gRPC by using the CLI
-
Add HTTP profile with HTTP/2 and HTTP/2 direct enabled.
-
Enable global back end HTTP/2 support in HTTP parameter
-
Add load balancing virtual server of type SSL/HTTP and set HTTP profile
-
Add Service for gRPC endpoint and set HTTP profile
-
Bind gRPC end point service to load balancing virtual server
Add HTTP profile with HTTP/2 and HTTP/2 direct enabled
add ns httpProfile <name> - http2 ( ENABLED | DISABLED ) [-http2Direct ( ENABLED | DISABLED )]
add ns httpProfile http2gRPC -http2Direct ENABLED -http2 ENABLED
Enable global back-end HTTP/2 support through HTTP parameter
set ns httpParam -http2ServerSide( ON | OFF )
set ns httpParam -http2ServerSide ON
Add load balancing virtual server of type SSL/HTTP and set HTTP profile
add lb vserver <name> <service type> [(<IP address>@ <port>)] [-httpProfileName <string>]
add lb vserver lb-grpc HTTP 10.10.10.11 80 -httpProfileName http2gRPC
Add Service for gRPC endpoint and set HTTP profile
add service <name> (<IP> | <serverName> ) <serviceType> <port> [-httpProfileName <string>]
add service svc-grpc 10.10.10.10 HTTP 80 -httpProfileName http2gRPC
Bind gRPC end point service to load balancing virtual server
bind lb vserver <name> <serviceName>
bind lb vserver lb-grpc svc-grpc
Configure end-to-end gRPC deployment by using the GUI
Add HTTP profile with HTTP/2 and HTTP/2 direct enabled
-
Navigate to System > Profiles and click HTTP Profiles.
-
Select the HTTP/2 checkbox in a new HTTP profile or existing HTTP profile.
Enable global back end HTTP/2 support in HTTP parameter
-
Navigate to System > Settings > HTTP Parameters.
-
In the Configure HTTP Parameter page, select the HTTP/2 on Server Side checkbox.
-
Click OK.
Add load balancing virtual server of type SSL/HTTP and set HTTP profile
-
Navigate to Traffic Management > Load Balancing > Virtual Servers.
-
Click Add to create a load balancing virtual server for gRPC traffic.
-
In Load Balancing Virtual Server page, click Profiles.
-
In the Profiles section, select the profile type as HTTP.
-
Click OK and then Done.
Add Service for gRPC endpoint and set HTTP profile
-
Navigate to Traffic Management > Load Balancing > Services.
-
Click Add to create an application server for gRPC traffic.
-
In Load Balancing Service page, go to Profile section.
-
Under Profiles, add HTTP profile for gRPC endpoint.
-
Click OK and then Done.