Search code examples
kubernetestraefiktraefik-ingress

How to set max request body size in traefik ingress controller for kubernetes?


It's very easy to set up max request body size with nginx using client_max_body_size directive. How can I do the same with kubernetes traefik ingress controller. I know there is maxrequestbodybytes directive to do so but, I'm lost with how to set it up in yaml file describing my ingress.


Solution

  • Wasn't so easy to figure this out. There is a funky multiline way of specifying this config in yaml file. Please check option traefik.ingress.kubernetes.io/buffering to see he pipe (|) oprator in acction.

    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: example
      labels:
        domain: example.com
        deployment: production
      annotations:
        kubernetes.io/ingress.class: traefik
        traefik.ingress.kubernetes.io/frontend-entry-points: http
        traefik.ingress.kubernetes.io/buffering: |
          maxrequestbodybytes: 31457280
          memrequestbodybytes: 62914560
    spec:
      etc....