Nihal Khan
2 min readJul 19, 2023

NGINX Ingress? Kubernetes Ingress?

Looks good .. right !!!!!!!!!!

In this article, I will explain why I got the ERR_FAILED 413 error and the solutions I used to solve it.

The ERR_FAILED 413 error may occur when uploading a large file.

On web servers, file size limits are defined to prevent users from bottlenecking the server and unnecessary use of storage space. It may vary depending on the default settings of the web server, proxy or load balancer used for this application. For example, these limits are 1mb for Nginx and 2mb for Apache Server.

In my case, my application is running on Kubernetes and application network traffic is routed by Nginx Ingress.

Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Traffic routing is controlled by rules defined on the Ingress resource.

I mentioned above that the Nginx default upload limit is 1 mb. There are many default values like these in Nginx. You can change these values in your ingress .yaml file via annotaions.

What do annotations do?

Annotations applied to an Ingress resource allow you to use advanced NGINX features and customize/fine tune NGINX behavior for that Ingress resource.

Before the solution there was only one annotation in my ingress .yaml file.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: <ingress-name>
namespace: <namespace-name>
annotations:
kubernetes.io/ingress.class: "nginx"

But, kubernetes.io/ingress.class annotation was deprecated.

Before the IngressClass resource and ingressClassName field were added in Kubernetes 1.18, Ingress classes were specified with a kubernetes.io/ingress.class annotation on the Ingress. This annotation was never formally defined, but was widely supported by Ingress controllers.

What is the solution?

Actually this error was fixed with just a single ingress annotation. However, while researching the solution for this error, I saw different annotation prefixes. The two different solutions I tried are as follows.

nginx.org/client-max-body-size: "1024m"
nginx.ingress.kubernetes.io/proxy-body-size: "1024m"
nginx.org annotation solved my problem.

However, what is the difference between these two annotations?

I learned that there are two different nginx ingress controller options that can be used in kubernetes.

These are NGINX and Kubernetes Community Ingress Controller.

If you are using the community version, you need to specify your nginx annotations with the nginx.ingress.kubernetes.io prefix. Other Annotations

If you are using the nginx version, you should use the nginx.org prefix. Other Annotations

You can examine the differences and comparisons in detail from the links in the reference section below.

There is much to learn from even a simple error. And if you are using Kubernetes it is possible to learn something new every day :)

Reference

Comparing Ingress controllers for Kubernetes

NGINX Ingress Controller Options

NGINX Annotations

Community version Annotations

Kubernetes Ingress

Nihal Khan
Nihal Khan

Written by Nihal Khan

I’m predominantly a JavaScript developer with 11+ years of development experience in building software with Node, React Native, ReactJs , Angular and OOJS .

No responses yet