github.com/nginxinc/kubernetes-ingress@v1.12.5/examples/grpc-services/README.md (about)

     1  # gRPC support
     2  
     3  To support a gRPC application with NGINX Ingress controllers, you need to add the **nginx.org/grpc-services** annotation to your Ingress resource definition.
     4  
     5  ## Prerequisites 
     6  
     7  * HTTP/2 must be enabled. See `http2` ConfigMap key in the [ConfigMap](https://docs.nginx.com/nginx-ingress-controller/configuration/global-configuration/configmap-resource/#listeners) 
     8  * Ingress resources for gRPC applications must include TLS termination.
     9  
    10  ## Syntax
    11  
    12  The `nginx.org/grpc-services` specifies which services are gRPC services. The annotation syntax is as follows:
    13  ```
    14  nginx.org/grpc-services: "service1[,service2,...]"
    15  ```
    16  
    17  ## Example
    18  
    19  In the following example we load balance three applications, one of which is using gRPC:
    20  ```yaml
    21  apiVersion: networking.k8s.io/v1beta1
    22  kind: Ingress
    23  metadata:
    24    name: grpc-ingress
    25    annotations:
    26      nginx.org/grpc-services: "grpc-svc"
    27      kubernetes.io/ingress.class: "nginx"
    28  spec:
    29    tls:
    30    - hosts:
    31      - grpc.example.com
    32      secretName: grpc-secret
    33    rules:
    34    - host: grpc.example.com
    35      http:
    36        paths:
    37        - path: /helloworld.Greeter
    38          backend:
    39            serviceName: grpc-svc
    40            servicePort: 50051
    41        - path: /tea
    42          backend:
    43            serviceName: tea-svc
    44            servicePort: 80
    45        - path: /coffee
    46          backend:
    47            serviceName: coffee-svc
    48            servicePort: 80
    49  ```
    50  *grpc-svc* is a service for the gRPC application. The service becomes available at the `/helloworld.Greeter` path. Note how we used the **nginx.org/grpc-services** annotation.