无法通过Kong Gateway访问gRPC服务端点

问题描述 投票:0回答:1

gRPC服务(在springboot中开发),作为docker容器部署在AWS linux(ec2)上。使用端口转发-p6565:6565启动docker镜像。现在,当通过膝上型计算机上的BloomRPC直接命中时,它可以正常工作:ec2.IP:6565 Package.Service.Method

在香港配置的服务和路线:

{
            "host": "ec2.IP",
            "created_at": 1588403433,
            "connect_timeout": 60000,
            "id": "e657d8df-6247-458a-a8e8-bec00c41e03c",
            "protocol": "grpc",
            "name": "aws-grpc1",
            "read_timeout": 60000,
            "port": 6565,
            "path": null,
            "updated_at": 1588403433,
            "retries": 5,
            "write_timeout": 60000,
            "tags": null,
            "client_certificate": null
}

Route:
{
            "strip_path": false,
            "path_handling": "v0",
            "updated_at": 1588403452,
            "destinations": null,
            "headers": null,
            "protocols": [
                "grpc",
                "grpcs"
            ],
            "created_at": 1588403452,
            "snis": null,
            "service": {
                "id": "e657d8df-6247-458a-a8e8-bec00c41e03c"
            },
            "name": "aws-grpc1-route1",
            "methods": null,
            "preserve_host": false,
            "regex_priority": 0,
            "paths": [
                "/grpc2"
            ],
            "sources": null,
            "id": "5739297e-3be7-4a0d-8afb-cfa8ed01cec2",
            "https_redirect_status_code": 426,
            "hosts": null,
            "tags": null
        }

现在通过grpcurl击中它->它不起作用:

grpcurl -v -d "{}" -insecure ec2.ip:8443 package.service.pingMethod

Error invoking method "package.service.ping": target server does not expose service "package.service"

这里是看起来很相关的kong配置:

"proxy_listen": [
            "0.0.0.0:8000 reuseport backlog=16384",
            "0.0.0.0:8443 **http2** ssl reuseport backlog=16384"
        ],

所以这是查询:(1)也可以将8000配置为https不安全->通过在kong-container的开头通过env KONG_PROXY_LISTEN变量来传递

    -e "KONG_PROXY_LISTEN=0.0.0.0:8000 http2, 0.0.0.0:8443 http2 ssl" 

这好吗?

((2)如何启用服务器端反射?或/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo的用途是什么?

grpc api-gateway grpc-java kong
1个回答
0
投票

更多更新:

部署在kong.ingress后面的gRPC运行正常:

grpcurl -v -d "{\"greeting\":\"111\"}" -insecure acfb0xxxxx.elb.us-east-2.amazonaws.com:443 hello.HelloService.SayHello

响应:

Resolved method descriptor:
rpc SayHello ( .hello.HelloRequest ) returns ( .hello.HelloResponse );

Request metadata to send:
(empty)

Response headers received:
content-type: application/grpc
date: Sat, 02 May 2020 07:00:17 GMT
server: openresty
trailer: Grpc-Status
trailer: Grpc-Message
trailer: Grpc-Status-Details-Bin
via: kong/2.0.3
x-kong-proxy-latency: 1
x-kong-upstream-latency: 9

Response contents:
{
  "reply": "hello 111"
}

Response trailers received:
(empty)
Sent 1 request and received 1 response

当在kong-API网关上配置时,它不起作用:

grpcurl -v -d "{\"greeting\":\"111\"}" -insecure kong.ce-gateway.ip:8443 hello.HelloService.SayHello
Error invoking method "hello.HelloService.SayHello": failed to query for service descriptor "hello.HelloService": rpc error: code = Internal desc = An invalid response was received from the upstream server
© www.soinside.com 2019 - 2024. All rights reserved.