Nginx Ingress Error 413 Request Entity Too Large

2/28/2022

I use ingress-nginx with Helm Chart. I used to have the problem, that when I would upload a file (50MB) that I would get the error 413 Request Entity Too Large nginx.

So I changed the proxy-body-size value in my values.yaml file to 150m, so I should now be able to upload my file. But now I get the error "413 Request Entity Too Large openresty/1.13.6.2". I checked the nginx.conf file on the ingress controller and the value for client_max_body_size is correctly set to 150m.

After some research I found out that openresty is used by the lua module in nginx. Does anybody know how I can set this setting too for openresty, or what parameter I am missing ?

My current config is the following:

values.yml:

ingress-nginx:
  defaultBackend:
    nodeSelector:
      beta.kubernetes.io/os: linux
  controller:
    replicaCount: 2
    resources:
      requests:
        cpu: 1
        memory: 4Gi
      limits:
        cpu: 2
        memory: 7Gi
    autoscaling:
      enabled: true
      minReplicas: 2
      maxReplicas: 10
      targetCPUUtilizationPercentage: 90
      targetMemoryUtilizationPercentage: 90
    ingressClassResource:
      name: nginx
      controllerValue: "k8s.io/nginx"
    nodeSelector:
      beta.kubernetes.io/os: linux
    admissionWebhooks:
      enabled: false
      patch:
        nodeSelector:
          beta.kubernetes.io/os: linux
    extraArgs:
      ingress-class: "nginx"
    config:
      proxy-buffer-size: "16k"
      proxy-body-size: "150m"
      client-body-buffer-size: "128k"
      large-client-header-buffers: "4 32k"
      ssl-redirect: "false"
      use-forwarded-headers: "true"
      compute-full-forwarded-for: "true"
      use-proxy-protocol: "false"

ingress.yml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  namespace: namespacename
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/proxy-buffer-size: "128k"
    nginx.ingress.kubernetes.io/proxy-buffers-number: "8"
    nginx.ingress.kubernetes.io/client-body-buffer-size: "128k"
    nginx.ingress.kubernetes.io/proxy-body-size: "150m"
spec:
  tls:
    - hosts:
        - hostname
  rules:
    - host: hostname
      http:
        paths:
          - path: /assets/static/
            pathType: ImplementationSpecific
            backend:
              service:
                name: servicename
                port:
                  number: 8080
-- Alex
kubernetes
lua
nginx
nginx-ingress

0 Answers