Traefik作为入口控制器+服务器GRPC-未知:未收到状态 [英] Traefik as an ingress controller + Server GRPC - UNKNOWN: No status received

查看:110
本文介绍了Traefik作为入口控制器+服务器GRPC-未知:未收到状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在AKS中使用traefik作为入口控制器,我有一个在本地正确运行的grpc服务,但是在traefik背后存在一些问题.

I use traefik as an ingress controller in AKS, I have a grpc service that run correctly locally, but I have some problem behind traefik.

当GRPC服务器返回错误时,我可以正确收到它,但是当它发送正常响应时,我没有收到它:

When the GRPC server return an error, I receive it correctly, but when it send a normal response, I didn’t receive it:

grpcServer@grpc.test.com:443> client.Ping({}, metadata, pr)
EventEmitter {}
grpcServer@grpc.test.com:443> 
Error:  { Error: 2 UNKNOWN: No status received
    at Object.exports.createStatusError (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/common.js:91:15)
    at Object.onReceiveStatus (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:1204:28)
    at InterceptingListener._callNext (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:845:24) code: 2, metadata: {}, details: 'No status received' }

vs

grpcServer@localhost:10000> client.Ping({}, metadata, pr)
EventEmitter {}
grpcServer@localhost:10000> 
{
  "response": "PONG"
}

错误:

grpcServer@grpc.test.com:443> client.Ping({}, pr)
EventEmitter {}
grpcServer@grpc.test.com:443> 
Error:  { Error: 16 UNAUTHENTICATED: incorrect serial number
    at Object.exports.createStatusError (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/common.js:91:15)
    at Object.onReceiveStatus (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:1204:28)
    at InterceptingListener._callNext (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:845:24)
  code: 16,
  metadata:
   { 'content-length': '0', date: 'Wed, 06 Feb 2019 21:32:38 GMT' },
  details: 'incorrect serial number' }

k8s服务yml:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: velcloud-grpc
  namespace: production
  annotations:
    kubernetes.io/ingress.class: traefik
    ingress.kubernetes.io/protocol: h2c
    traefik.protocol: h2c
spec:
  rules:
    - host: grpc.test.com
      http:
        paths:
          - path: /
            backend:
              serviceName: velcloud-grpc
              servicePort: grpc

更多信息

经过一些调试后,我检查了收到的响应:

After some debugging, I inspected the received response:

{ client_close: true,
  metadata: { date: [ 'Wed, 06 Feb 2019 23:48:06 GMT' ] },
  read: <Buffer 0a 04 50 4f 4e 47>,
  status:
   { code: 2,
     details: 'No status received',
     metadata: Metadata { _internal_repr: {} } } } { code: 2,
  details: 'No status received'
}

这里唯一的问题是状态,读取的内容反序列化后正确的响应是: {响应:'PONG'}

The only problem here is the status, the read content the right response once deserialized: { response: 'PONG' }

我不知道为什么将状态设置为2(未知)而不是0(确定).

I don't know why the status is set to 2 (UNKNOWN) and not 0 (OK).

推荐答案

在我的Traefik配置中,我使用重试中间件( [retry] ),而Traefik v1.7.8有一个错误:

In my Traefik configuration, I use the retry middleware([retry]) and Traefik v1.7.8 have a bug:

重试中间件已经发送了标头后,请使用原始标头映射来发送标头.

When the retry middleware has already sent the headers, use the original headers map to be able to send trailers.

https://github.com/containous/traefik/pull/4442

我使用此修复程序手动构建了v1.7分支,一切再次正常!非常感谢Containous(达米恩和朱利安!)帮助调试此问题!

I manually build the v1.7 branch with this fix and everything works again! Thanks a lot to Containous (Damien and Julien!) for helping to debug this issue!

这篇关于Traefik作为入口控制器+服务器GRPC-未知:未收到状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆