I'm running a SSE server on a VPS and it works perfectly, no problems at all, but due to scalability reasons I needed to move it to another server.

I moved the server to Google Cloud Platform/Google Container Engine and Kubernetes/Ingress. But now I've encountered that I can't keep a SSE connection effectively, it's completely unstable and it closes connections by itself.

Is there anything special I have to do to run a SSE server over Kubernetes/Ingress?

I assume my code/software runs perfect and that is not the issue, due it works perfectly in Kubernetes, VPS, on my machine, everywhere, just not when I add the Ingress configuration, and I'm doing this because I want HTTPS over the Kubernetes load-balancer.

  • What are you running on your client and server side for SSE? Have you tried using a different client like curl to confirm if the connection remains open or is getting closed? – Tuxdude Jun 27 '17 at 3:25
  • It wasn't the client. I got it working, for no-closing connections like sockets I've found that you gotta set a really big timeout on Ingress, about 86,400 seconds (a day). – Carlos C Jun 28 '17 at 0:42

Seems that Ingress defaults timeout was 30 seconds for any type of connection, I've set it to 86,400 (a day) and now the socket works good.

You can change the timeout over the Google console like this:

➜ export BACKEND=xxx-xxx-xxxxxx
➜ gcloud compute backend-services update $BACKEND --global --timeout=86400 # seconds
Updated [https://www.googleapis.com/compute/v1/projects/xxxxxxxxx/global/backendServices/xxx-xxx-xxxxxx].
| improve this answer | |
  • Can the timeout be set in the yaml file or do you have to manually change it in Google's console? – crickeys Jun 29 '17 at 0:54
  • @crickeys You have to do it over the Google's console. I have updated my answer. – Carlos C Jun 29 '17 at 4:27
  • What does "xxx-xxx-xxxxxx" means in "BACKEND=xxx-xxx-xxxxxx" ? – John Balvin Arias Oct 8 '18 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.