zero-to-jupyterhub-k8s
zero-to-jupyterhub-k8s copied to clipboard
Document websocket connectivity configuration for nginx ingress
When the service is set to ClusterIP and an ingress is created using nginx ingress, the websocket is failing, which will result in only UI is available but nothing will compile. There is no user feed back but only seeing the web console of the browser we can see the "wss://..." connectivity is failing. Though it is outside the scope (setting LoadBalancer as service will work, but need to use IP) its better to document this.
Proposed change
Need to capture the ingress annotation required for the ingress nginx that will enable websocket connectivity properly.
Alternative options
Using LoadBalancer option
Who would use this feature?
For those installing for first time
(Optional): Suggest a solution
Need to mention these annotation somewhere: nginx.org/websocket-services nginx.ingress.kubernetes.io/ssl-redirect nginx.ingress.kubernetes.io/secure-backends
Reference: https://stackoverflow.com/questions/58534215/kubernetes-ingress-websockets-connection-issue
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:
When the service is set to ClusterIP and an ingress is created using nginx ingress, the websocket is failing, which will result in only UI is available but nothing will compile. There is no user feed back but only seeing the web console of the browser we can see the "wss://..." connectivity is failing. Though it is outside the scope (setting LoadBalancer as service will work, but need to use IP) its better to document this.
Proposed change
Need to capture the ingress annotation required for the ingress nginx that will enable websocket connectivity properly.
Alternative options
Using LoadBalancer option
Who would use this feature?
For those installing for first time
(Optional): Suggest a solution
Need to mention these annotation somewhere: nginx.org/websocket-services nginx.ingress.kubernetes.io/ssl-redirect nginx.ingress.kubernetes.io/secure-backends
Reference: https://stackoverflow.com/questions/58534215/kubernetes-ingress-websockets-connection-issue
Thank you very much @vsndev3 for raising the issue, I had the exact same problem and was able to solve it with your solution.
I absolutely agree that the chart should be updated to include theses annotation for thoses using a ClusterIP service instead of loadbalancer.
Here is how I modifier the values.yaml file to solve the issue:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/proxy-body-size: 600m
nginx.org/client-max-body-size: "10m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/secure-backends: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/websocket-services: proxy-public
nginx.org/websocket-services: proxy-public
ingressClassName:
hosts:
- yourdomain.com
pathSuffix:
pathType: Prefix
tls:
- secretName: yoursecret
hosts:
- yourdomain.com
These annotations are specific to your ingress controller so they can't be hard-coded. For example, ingress-nginx (not the same as nginx-ingress!) supports websockets by default https://kubernetes.github.io/ingress-nginx/user-guide/miscellaneous/#websockets