Increase websocket timeout in Google cloud Ingress HTTP(S) load banacer

10/16/2017

I tried to proxy websocket using ingress HTTP(s) load balancer in google cloud container engine. Connection establishment and data reading properly. But connection timeout after 30 s. Google documentation (https://cloud.google.com/compute/docs/load-balancing/http/) says to change timeout value (timeoutSec in the API)

But cannot found a proper way to do this. I tried it with google cloud console. Is there a way to set timeout to websocket in .yaml file.

This is my ingress controller.

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" is the websocket service.

Client is javascript.

$scope.webSocket=new WebSocket("ws://"+ location.host"+"/streaming/test");
 $scope.webSocket.onopen = function () {
       console.log("CONNECTED");
 };

Thanks in advance.

-- Nuwan Sameera
google-kubernetes-engine
javascript
kubernetes

2 Answers

4/1/2020

Google Kubernetes Engine specific docs for configuring the timeout can be found here:

https://cloud.google.com/kubernetes-engine/docs/how-to/configure-backend-service

-- marko
Source: StackOverflow

10/18/2017

There is a solution in here. https://cloud.google.com/compute/docs/reference/latest/backendServices

OR can increase time out using Google cloud console.

-- Nuwan Sameera
Source: StackOverflow