在Google云中增加websocket超时Ingress HTTP(S)加载禁止者
问题描述:
我试图在谷歌云容器引擎中使用入口HTTP(s)负载均衡器代理websocket。正确连接建立和数据读取。但30秒后连接超时。 Google文档(https://cloud.google.com/compute/docs/load-balancing/http/)说要更改超时值(API中的timeoutSec)在Google云中增加websocket超时Ingress HTTP(S)加载禁止者
但是找不到合适的方法来执行此操作。我用谷歌云控制台试了一下。有没有办法在.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");
};
在此先感谢。
答
这里有一个解决方案。 https://cloud.google.com/compute/docs/reference/latest/backendServices
或者可以使用Google云端控制台增加超时时间。