Ingress gRPC Example

The example ingress configuration in grpc-ingress.yaml shows how to route gRPC traffic to backend services.

Deploy the Demo App

For this demo we will use GCP’s microservices demo app.

$ kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/microservices-demo/master/release/kubernetes-manifests.yaml

Since gRPC is binary-encoded, you also need the proto definitions for the gRPC services in order to make gRPC requests. Download this for the demo app:

$ curl -o demo.proto https://raw.githubusercontent.com/GoogleCloudPlatform/microservices-demo/master/pb/demo.proto

Deploy GRPC Ingress

You’ll find the example Ingress definition in examples/kubernetes/servicemesh/grpc-ingress.yaml.

$ kubectl apply -f https://raw.githubusercontent.com/cilium/cilium/1.12.6/examples/kubernetes/servicemesh/grpc-ingress.yaml

This defines paths for requests to be routed to the productcatalogservice and currencyservice microservices.

Just as in the previous HTTP Ingress Example, this creates a LoadBalancer service, and it may take a little while for your cloud provider to provision an external IP address.

$ kubectl get ingress
NAME            CLASS    HOSTS   ADDRESS           PORTS   AGE
grpc-ingress    cilium   *       <IP address>      80      3d

Make gRPC Requests to Backend Services

To issue client gRPC requests you can use grpcurl.

$ GRPC_INGRESS=$(kubectl get ingress grpc-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
# To access the currency service:
$ grpcurl -plaintext -proto ./demo.proto $GRPC_INGRESS:80 hipstershop.CurrencyService/GetSupportedCurrencies
#To access the product catalog service:
$ grpcurl -plaintext -proto ./demo.proto $GRPC_INGRESS:80 hipstershop.ProductCatalogService/ListProducts