How to increase max request body size on nginx ingress controller and kong

dweeb picture dweeb · Aug 2, 2019 · Viewed 7.7k times · Source

I have an a service that accepts POSTs with base64 encoded files in the body. I'm currently getting Error: 413 Request Entity Too Large when I POST anything larger than 1MB, otherwise it works fine.

My setup has kong proxying to the service. I have the following annotation for the proxy's ingress installed via the stable kong helm chart :

      kubernetes.io/ingress.class: "nginx"
      ingress.kubernetes.io/ssl-redirect: “true”
      ingress.kubernetes.io/proxy-body-size: 50m

I also added this to the kong env values:

client_max_body_size: 0

My understanding is this should update the nginx.conf

Kong has an nginx-ingress sitting in front of it which I installed with the stable helm chart. For the ingress-controller I have set:

--set controller.config.proxy-body-size: "50m"

However none of these settings are working. Looking through the ingress-controller's pod logs I see:

2019/08/02 15:01:34 [warn] 42#42: *810139 a client request body is buffered to a temporary file /tmp/client-body/0000000014, client: 1X.XXX.X0.X, server: example.com, request: "POST /endpoint HTTP/1.1", host: "example.com"

And the corresponding log in the kong pod:

2019/08/02 15:01:39 [warn] 33#0: *1147388 a client request body is buffered to a temporary file /usr/local/kong/client_body_temp/0000000017, client: XX.XXX.XXX.XX, server: kong, request: "POST /ENDPOINT HTTP/1.1", host: "example.com"
10.120.20.17 - - [02/Aug/2019:15:01:39 +0000] "POST /endpoint HTTP/1.1" 413 794 "-" "PostmanRuntime/7.15.2"

Is there another setting I am missing or am I going about this wrong? How can I get this to work as expected.

  • If I just POST to the pod directly using it's IP, no ingress controllers involved I get the same 413 error. Does kubernetes have a default ingress somewhere that also needs to be changed?

Answer

dweeb picture dweeb · Aug 26, 2019

the annotation seemed to work fine. The limitation I was running into was because the code I was testing was in a kubeless. The kubeless functions use bottle and the ingress limit was on bottle. I increased that in a custom python3.7 image for kubeless and all worked fine.