<p>We recently upgraded from nginx ingress controller from 0.8.2 to 0.11.0, and started getting 502 bad gateway error
on large file uploads around 10 MB or higher, we have set the <strong>client_max_body_size</strong> to <strong>500m</strong> through <strong>proxy-body-size</strong> in the configmap and <strong>verified</strong> 
its set.
The smaller files around 5-6 MB works fine. </p>

<p>There are no errors in the logs, just these  messages. </p>

<blockquote>
  <p>redacted - [redacted] - - [25/Mar/2018:02:08:49 +0000] "POST
  /redacted/upload HTTP/1.1" 000 0 "<a href="https://redacted/" rel="nofollow noreferrer">https://redacted/</a>" "Mozilla/5.0
  (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
  Chrome/65.0.3325.181 Safari/537.36" 3371263 10.850 [uploader-443] ----</p>
</blockquote>

<p>and </p>

<blockquote>
  <p>[warn] 30684#30684: *42090 a client request body is buffered to a
  temporary file /var/lib/nginx/body/0000000482, client: redacted,
  server: redacted, request: "POST /redacted/upload HTTP/1.1", host:
  "redacted", referrer: "<a href="https://redacted/" rel="nofollow noreferrer">https://redacted/</a>"</p>
</blockquote>

<p>The proxied server is tomcat and requests do not make it to tomcat.
We have tried increasing:</p>

<ul>
<li><em>timeouts</em> </li>
<li><em>proxy_buffers</em> </li>
<li><em>proxy_buffer_size</em></li>
</ul>

<p>but nothing worked.</p>

<p>Going back to <strong>0.8.2</strong> version resolves the issue. </p>

<p><strong>update 1: nginx.conf snippet</strong> </p>

<blockquote>
  <p>location /redacted/ {</p>
  
  <p>port_in_redirect off;</p>
  
  <p>set $proxy_upstream_name "redacted-443";</p>
  
  <p>....</p>
  
  <p>....</p>
  
  <p>client_max_body_size                    "500m";</p>
</blockquote>

<p>It looks like you may need to set the bigger file size globally for all Ingress rules.</p>
<p>This can be achieved by using <strong><a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#custom-max-body-size" rel="nofollow noreferrer">proxy-body-size</a></strong> parameter i.e.:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 20mb
.... 
</code></pre>
<p>Afterwards it should work for files bigger than 10MB.</p>
