ingress-nginx: Text Streaming not working when using Nginx-Ingress on Kubernetes
Problem Description: I have used the Nginx-Ingress service on my Azure Kubernetes Cluster, using the command:
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace --set controller.service.loadBalancerIP=<ip-adress> --set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz
My kubernetes cluster is basically a frontend docker container interacting with a third-party service, streaming some text back to the frontend until a longer message has been completed. When I test the docker container locally it works perfectly, all the text gets streamed in real time word-by-word until the text is completed. When I put it on my kubernetes cluster behind the Nginx-Ingress, it only get the whole text chunk when all the has been completed (it works on my cellphone tho).
Investigation: I tried to investigate the problem online, and looks like the issue could be related to the proxy-buffering. I found several suggestions online, about changing e.g.:
proxy-http-version 1.1 chunked-transfer-encoding on proxy_pass http://localhost:3000/ proxy_request_buffering off
I have tried to implement them by using: kubectl apply -f setting.yaml - with this information in the .yaml file
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nnais-streamlit-ingress
annotations:
nginx.ingress.kubernetes.io/proxy-buffering: "off"
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/chunked-transfer-encoding: "on"
nginx.ingress.kubernetes.io/proxy_pass: "http://localhost:3000/"
nginx.ingress.kubernetes.io/proxy_request_buffering: "of"
It did not work, however. I have spend hours looking online, and have not found a simple explanation how to get this to work on my Azure Kubernetes cluster. Do I have to change a configuration before doing my helm installation, and how to instruct nginx-ingress to use that configuration using the helm installation. I have not been able to found an answers on how to do that.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (6 by maintainers)
@paolosalvatori It is on by default https://nginx.org/en/docs/http/ngx_http_core_module.html#chunked_transfer_encoding. In config you can set this way