kuberneteswebsocketopenshiftopenshift-3

openshift 3.12 websocket ERR_CONNECTION_ABORTED


I would like to start websocket connections (ws://whaterver) in OpenShift but somehow they always ends with ERR_CONNECTION_ABORTED immediately (new WebSocket('ws://whatever').

First I thought that the problem is in our application but I created a minimal example and I got the same result.

First I created a pod and started this minimal Python websocket server.

import asyncio
import websockets
async def hello(websocket, path):
    name = await websocket.recv()
    print(f"< {name}")
    greeting = f"Hello {name}!"
    await websocket.send(greeting)
    print(f"> {greeting}")

start_server = websockets.serve(hello, "0.0.0.0", 8000)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

Then I created a service (TCP 8000) and created a routing too and I got the same result.

I also tried to use different port or different targets (e.g.: /ws), without success. This minimal script was able to respond to a simple http request, but for the websocket connection it can't.

Do you have any idea what could be the problem? (by the documentation these connections should work as they are) Should I try to play with some routing environment variables or are there any limitations which are not mentioned in the documentation?


Solution

  • Posting Károly Frendrich answer as community wiki:

    Finally we realized that the TLS termination is required to be set.

    It can be done using Secured Routes