Kubernetes中的插座IO保持断开连接
我想在Kubernetes启动簇的插座IO应用程序。当我创建服务(无论是nodeport还是LoadBalancer)时,客户端应用程序会不断断开连接,并且再次重新连接以下日志:
undefined
oah4g28zZCw36g1MAAAm
undefined
undefined
oac4g28zZCw36g1MFAAAx
undefined
这迅速发生。
但是,当我直接连接到一个吊舱时,问题就会消失,连接变得稳定。
我如何通过以下命令来创建服务:
kubectl expose deployment xxx --type=LoadBalancer --port=80 --target-port=3000
我知道服务中缺少诸如keetalive或超时配置之类的东西,但是我该如何添加或更好地说出适当地配置套接字IO的服务?
I'd like to launch a clustered Socket IO application in Kubernetes. When I create a service (whether NodePort or LoadBalancer) the client application keeps getting disconnected and it reconnects again with the following logs:
undefined
oah4g28zZCw36g1MAAAm
undefined
undefined
oac4g28zZCw36g1MFAAAx
undefined
and this happens rapidly.
However, when I connect to a single Pod directly, the problem goes away and the connection becomes stable.
How I am creating the service is by the following command:
kubectl expose deployment xxx --type=LoadBalancer --port=80 --target-port=3000
I know that something such as a KeepAlive or Timeout configuration is missing in the service, but how can I add those or better said properly configure the service for Socket IO?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
sessionaffition:clientip
,它将从K8S服务管理会话。仅适用于参考: WS WebSocket服务器库在加载平衡器后面使用时是否需要粘性会话?
You can use the
sessionAffinity: ClientIP
, which will manage the session from K8s service.just for ref : Does the ws websocket server library requires sticky session when it is used behind a load balancer?