#devops #http #kubernetes

If you're using the Nginx Ingress Controller on Kubernetes, you might have stumbled on a response code 413 when you upload items via the ingress controller.

According to http.cat, 413 means Payload too large. This is because the default maximum body size in the ingress controller is configured to a rather small default value.

Luckily, there is an annotion you can add to the ingress definition which can change this value. The annotation you need to use is called nginx.ingress.kubernetes.io/proxy-body-size.

You can configure it as follows:

 1apiVersion: extensions/v1beta1
 2kind: Ingress
 4  annotations:
 5    nginx.ingress.kubernetes.io/proxy-body-size: "0"
 6    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
 7    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
 8    kubernetes.io/tls-acme: 'true'
 9  name: docker-registry
10  namespace: docker-registry
12  tls:
13  - hosts:
14    - registry.<your domain>
15    secretName: registry-tls
16  rules:
17  - host: registry.<your domain>
18    http:
19      paths:
20      - backend:
21          serviceName: docker-registry
22          servicePort: 5000
23        path: /

There are many more annotations you can use. You can find the full list here.