我有一个简单的SignalR Client Server设置,其中我的Server由运行在kubernetes集群中的Web应用程序组成,并通过入口控制器公开了这样的服务:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
# Enable PROXY protocol
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"
name: coreapilocal-ingress
spec:
rules:
- host: coreapilocal.localhost
http:
paths:
- backend:
serviceName: coreapilocal-service
servicePort: 80
path: /
- backend:
serviceName: coreapilocal-service
servicePort: 80
path: /*
还有尝试通过入口调用SignalR Server方法的HTML客户端吗? 但是由于某种原因,此呼叫是否由于某些原因而被忽略了?
我在某处读到Http被入口剥夺了?从而无法识别来电? 有办法避免这种情况吗?或解决这个问题?
我在上面给出了另一篇我在SE中找到的帖子,但是在我看来,这似乎不起作用。
答案 0 :(得分:0)
要使SignalR正常运行(通常对于WebSockets),您应该启用Sticky Sessions
将注释nginx.ingress.kubernetes.io/affinity: "cookie"
添加到入口工作负载定义:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
# Enable PROXY protocol
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"
nginx.ingress.kubernetes.io/affinity: "cookie"
name: coreapilocal-ingress
spec:
rules:
- host: coreapilocal.localhost
http:
paths:
- backend:
serviceName: coreapilocal-service
servicePort: 80
path: /
- backend:
serviceName: coreapilocal-service
servicePort: 80
path: /*