<p>How do I set the <code>client_max_body_size</code> parameter for a single subdomain? I have a server that will accept file uploads up to 5TB. All the examples I've looked at show you how to set it globally. I have multiple rules in my ingress.yaml, I don't want every single rule to inherit the <code>client_max_body_size</code> parameter, only the file upload server should.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-nginx
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: homepage
          servicePort: 80
  - host: storage.example.com
    http:
      paths:
      - backend:
          serviceName: storage
          servicePort: 80
</code></pre>

<p>In the above ingress.yaml, I want to set <code>client_max_body_size</code> for the <code>storage</code> service only, which is located at the host <code>storage.example.com</code>.</p>

Eric Guan
<p>Because I don't see <code>client-max-body-size</code> on the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/" rel="nofollow noreferrer">list of annotations</a>, that leads me to believe you'll have to use the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#configuration-snippet" rel="nofollow noreferrer">custom-config-snippet</a> to include the <code>client_max_body_size 5tb;</code> for that Ingress:</p>

<pre><code>metadata:
  annotations:
    nginx.ingress.kubernetes.io/configuration-snippet: |
      client_max_body_size 5tb;
</code></pre>

<p>However, given that you said that you only want it for <code>storage.example.com</code>, you'll need to split the Ingress config for <code>storage.example.com</code> out into its own Ingress resource, since (AFAIK) the annotations are applied to every <code>host:</code> record in the Ingress resource.</p>
