我试图在谷歌 Cloud 容器引擎中使用入口HTTP(s)负载均衡器代理websocket . 正确连接 Build 和数据读取 . 但是30秒后连接超时 . Google文档(https://cloud.google.com/compute/docs/load-balancing/http/)表示要更改 timeout value (timeoutSec in the API)
但是找不到合适的方法来做到这一点 . 我用谷歌 Cloud 控制台试了一下 . 有没有办法在.yaml文件中设置超时到websocket .
这是我的入口控制器 .
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: load-balancer
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: dash-board
servicePort: 2020
- path: /auth/*
backend:
serviceName: auth-service
servicePort: 1111
- path: /filter-service/*
backend:
serviceName: filter
servicePort: 8081
- path: /data-service/*
backend:
serviceName: data-service
servicePort: 8090
- path: /streaming/*
backend:
serviceName: streaming
servicePort: 8080
“streaming”是websocket服务 .
客户端是javascript .
$scope.webSocket=new WebSocket("ws://"+ location.host"+"/streaming/test");
$scope.webSocket.onopen = function () {
console.log("CONNECTED");
};
提前致谢 .
1 回答
这里有一个解决方案 . https://cloud.google.com/compute/docs/reference/latest/backendServices
或者可以增加使用Google Cloud 控制台的时间 .