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:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
    kubernetes.io/tls-acme: 'true'
  name: docker-registry
  namespace: docker-registry
spec:
  tls:
  - hosts:
    - registry.<your domain>
    secretName: registry-tls
  rules:
  - host: registry.<your domain>
    http:
      paths:
      - backend:
          serviceName: docker-registry
          servicePort: 5000
        path: /

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

Related Posts

  • Nginx Ingress with Let's Encrypt on Kubernetes
  • Getting the real IP address in Kubernetes
  • Proxying an external website with Nginx Ingress
  • Stern 1.13.0, templates and line-endings
  • Setting up and using an NFS share in Kubernetes