Is it possible to call gRPC service behind google cloud load balancer

Viewed 44

I have a client calling my service in cloud-run that is serving a gRPC API. I am not opening up the url to all traffic(public) or using authentication instead i have internal only traffic/ cloud load-balancing access my cloud-run running on the gRPC port.

Now in order for my client to reach the service, I have created an External LB with target http(s)/2 proxy backend ended with serverless network endpoint group. I have created DNS record for the external ip.

In order to reach the service, I am having to pass the domain-name:port(Ex test-grpc.com:443) because the gRPC url can’t start with http or https as gRPC uses raw tcp instead of http.

I have two questions here:

  1. Is it possible for the client to call the service over https://test-grpc.com:443 or what are the capabilities that i have to ask for the client to build for allowing connection through https url.

  2. If the above cant be done, Is it possible to create a request path in the UrlMap to access the service like "test-grpc.com:443/grpc-1" because I want to be able to utilize the loadbalancer to attach more services like this using the rewrites. Ex: /grpc-1 in the url will send to default backend service and /grpc-2 with send to another backend service.

Example failed client request:

grpcurl -d '{ 
 "key1": "value1",
 "name": "jjj",
 "age": "20",
 "region":"US",
 "occupation":"student"
}' test-grpc.com:443/grpc-1 v1protos.Student.Info
Failed to dial target host "test-grpc.com:443/grpc-1": dial tcp: address tcp/443/grpc-1: unknown port
defaultService: projects/test/global/backendServices/grpc-serv
name: allpaths
routeRules:
- matchRules:
  - prefixMatch: /grpc-1
  priority: 1
  routeAction:
    weightedBackendServices:
    - backendService: projects/test/global/backendServices/grpc-serv
      weight: 100
    urlRewrite:
      pathPrefixRewrite: /

Note: This works without the rewrite rule as in if i forward the request to the default backend without any uri as mentioned above(2)

Thanks!

0 Answers
Related