早上好。我有一个 GRPC 服务器,我想在 Google Kubernetes Engine 上提供服务。我的集群已经nginx-ingress
安装了控制器,我目前正在使用它来提供 http/https 流量。这是我试图用来托管 GRPC 服务器的入口资源:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: grpc-ingress-nginx
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/grpc-backend: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
namespace: default
spec:
tls:
- hosts:
- bar.foo.com
secretName: reploy-tls
rules:
- host: bar.foo.com
http:
paths:
- backend:
serviceName: bar-backend-service
servicePort: 50051
这是应用程序的服务/部署:
apiVersion: v1
kind: Service
metadata:
name: bar-backend-service
namespace: default
spec:
selector:
app: bar-backend-app
ports:
- port: 50051
targetPort: 50051
name: grpc
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: bar-backend
labels:
app: bar-backend-app
namespace: default
spec:
replicas: 1
template:
metadata:
labels:
app: bar-backend-app
spec:
containers:
- name: bar-backend-image
image: gcr.io/himank-jay/bar-backend-image:TAG
ports:
- containerPort: 50051
name: grpc
当我运行grpc_cli ls bar.foo.com:443
(使用grpc_cli)时,我收到以下错误:
{"created":"@1580833741.460274000","description":"Error received from peer ipv4:x.x.x.x:x","file":"src/core/lib/surface/call.cc","file_line":1055,"grpc_message":"Socket closed","grpc_status":14}
来自的错误nginx-controller
如下:
x.x.x.x - - [04/Feb/2020:16:28:46 +0000] "PRI * HTTP/2.0" 400 157 "-" "-" 0 0.020 [] [] - - - - xxxxx
关于这里有什么问题的任何想法?或者关于如何调试这个的任何想法?