github.com/cilium/cilium@v1.16.2/Documentation/network/servicemesh/grpc.rst (about)

     1  .. only:: not (epub or latex or html)
     2  
     3      WARNING: You are looking at unreleased Cilium documentation.
     4      Please use the official rendered version released here:
     5      https://docs.cilium.io
     6  
     7  .. _gs_ingress_grpc:
     8  
     9  ********************
    10  Ingress gRPC Example
    11  ********************
    12  
    13  The example ingress configuration in ``grpc-ingress.yaml`` shows how to route
    14  gRPC traffic to backend services.
    15  
    16  Deploy the Demo App
    17  *******************
    18  
    19  For this demo we will use `GCP's microservices demo app <https://github.com/GoogleCloudPlatform/microservices-demo>`_.
    20  
    21  .. code-block:: shell-session
    22  
    23      $ kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/microservices-demo/main/release/kubernetes-manifests.yaml
    24  
    25  Since gRPC is binary-encoded, you also need the proto definitions for the gRPC
    26  services in order to make gRPC requests. Download this for the demo app:
    27  
    28  .. code-block:: shell-session
    29  
    30      $ curl -o demo.proto https://raw.githubusercontent.com/GoogleCloudPlatform/microservices-demo/main/protos/demo.proto
    31  
    32  
    33  Deploy GRPC Ingress
    34  *******************
    35  
    36  You'll find the example Ingress definition in ``examples/kubernetes/servicemesh/grpc-ingress.yaml``.
    37  
    38  .. literalinclude:: ../../../examples/kubernetes/servicemesh/grpc-ingress.yaml
    39  
    40  .. parsed-literal::
    41  
    42      $ kubectl apply -f \ |SCM_WEB|\/examples/kubernetes/servicemesh/grpc-ingress.yaml
    43  
    44  This defines paths for requests to be routed to the ``productcatalogservice`` and
    45  ``currencyservice`` microservices.
    46  
    47  Just as in the previous HTTP Ingress Example, this creates a LoadBalancer service,
    48  and it may take a little while for your cloud provider to provision an external
    49  IP address.
    50  
    51  .. code-block:: shell-session
    52  
    53      $ kubectl get ingress
    54      NAME           CLASS    HOSTS   ADDRESS         PORTS   AGE
    55      grpc-ingress   cilium   *       10.111.109.99   80      3s
    56  
    57  
    58  Make gRPC Requests to Backend Services
    59  **************************************
    60  
    61  To issue client gRPC requests you can use `grpcurl <https://github.com/fullstorydev/grpcurl#binaries>`_.
    62  
    63  .. code-block:: shell-session
    64  
    65      $ GRPC_INGRESS=$(kubectl get ingress grpc-ingress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
    66      # To access the currency service:
    67      $ grpcurl -plaintext -proto ./demo.proto $GRPC_INGRESS:80 hipstershop.CurrencyService/GetSupportedCurrencies
    68      #To access the product catalog service:
    69      $ grpcurl -plaintext -proto ./demo.proto $GRPC_INGRESS:80 hipstershop.ProductCatalogService/ListProducts