Kubernetes Ingress proxy-body-size annotation has stopped working

8/15/2019

I have an application running on a Kubernetes cluster. Sometime in the last month, my proxy-body-size ingress annotations suddenly stopped working. My app now returns 413: Request Entity Too Large whenever called with a large file.

This was after changing from ingress.kubernetes.io/proxy-body-size to nginx.ingress.kubernetes.io/proxy-body-size. Neither currently makes a difference.

The cluster runs stable/nginx-ingress version 1.15.0.

I must have missed something obvious, but I cannot for the life of me figure out what.

My ingress currently looks like this:

kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 20m
  creationTimestamp: "2019-07-03T08:43:43Z"
  generation: 1
  labels:
    app.kubernetes.io/instance: underskrift-detektor-env-v2
    app.kubernetes.io/managed-by: Tiller
    app.kubernetes.io/name: erst-env
    helm.sh/chart: erst-env-1.7.0
  name: underskrift-detektor-env-v2
  namespace: dokumentredskaber
  resourceVersion: "17086462"
  selfLink: /apis/extensions/v1beta1/namespaces/dokumentredskaber/ingresses/underskrift-detektor-env-v2
  uid: aa2cb597-9d6e-11e9-924b-7285e76b0ce4
spec:
  rules:
  - host: svik-ml-dev.erst.dk
    http:
      paths:
      - backend:
          serviceName: underskrift-detektor-app-v2
          servicePort: 8080
        path: /dokument-redskaber/underskrift-detektor/v2
  tls:
  - hosts:
    - svik-ml-dev.erst.dk
    secretName: erst-tls-secret
status:
  loadBalancer:
    ingress:
    - {}

The output of kubectl describe ing is:

Namespace:        dokumentredskaber
Address:
Default backend:  default-http-backend:80 (<none>)
TLS:
  erst-tls-secret terminates svik-ml-dev.erst.dk
Rules:
  Host                 Path  Backends
  ----                 ----  --------
  svik-ml-dev.erst.dk
                       /dokument-redskaber/underskrift-detektor/v2   underskrift-detektor-app-v2:8080 (<none>)
Annotations:
  nginx.ingress.kubernetes.io/proxy-body-size:  20m
Events:
  Type    Reason  Age                From                      Message
  ----    ------  ----               ----                      -------
  Normal  UPDATE  59m (x6 over 23h)  nginx-ingress-controller  Ingress dokumentredskaber/underskrift-detektor-env-v2
  Normal  UPDATE  59m (x6 over 23h)  nginx-ingress-controller  Ingress dokumentredskaber/underskrift-detektor-env-v2```
-- Bluebluebleu
kubernetes
kubernetes-helm
nginx-ingress

1 Answer

8/16/2019

From the official Nginx ingress documentation, the Annotation policy only takes string values, even for integers, they should be quoted.

Additionally, in some providers, you might want to also try adding the nginx.org/client-max-body-size annotation, alongside the proxy-body-size.

Is not stated in the question so just in case I will mention that the Nginx pods need to be restarted in order to pick the annotation's values.

-- yyyyahir
Source: StackOverflow