Recently I've been working on a toy app using Kubernetes. Part of the app is a web server that needs to support WebSockets. Currently, I'm using port-forwarding to access the web server and everything works just fine.
I'd like to switch to using an Ingress and IngressController to avoid using the port forwarding.
Here is my Ingress
config:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: app-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/secure-backends: "true"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
spec:
rules:
- http:
paths:
- path: /app
backend:
serviceName: web-svc
servicePort: 3030
- path: /ws
backend:
serviceName: web-svc
servicePort: 3030
Now accessing the app through $(minikube ip)/app
works just fine, but the WebSocket requests all fail because nginx is returning a 200 and not a 101.
I've tried adding the nginx.org/websocket-services
annotation but that doesn't seem to be working either.
Has anyone encountered a similar situation?
Cheers