Kubernetes - 413 Request Entity Too Large

How to solve 413 Request Entity Too Large in Kubernetes using NGINX Ingress.

If you've hit this error with a service in Kubernetes, you are likely facing a limitation at your ingress controller. If you're using the ingress-nginx controller, then the fix is to set an annotation on your ingress like this: nginx.ingress.kubernetes.io/proxy-body-size: "0". This will remove all limitations of body size from the ingress controller. Here are the docs for the matching NGINX directive. Alternatively, you could set the value to the largest body/file size you think might pass through your ingress. The only real downside to allowing extremely large files is needing the ability to scale your ingress and your pods. Of course, if your autoscaling is properly configured, you won't ever have to worry about that becoming an issue that affects the performance of the rest of your services. Just be sure to keep an eye out for disk i/o saturation if you have a lot of clients uploading in parallel.