kuberneteskubernetes-ingresshttp-status-code-413

Http Error 413 requesting k8s service which does not have an ingress configuration


Inside my cluster, there is a service that returns 413 when requested via POST with a large request client body size, > 10MB. Since this service should not be reachable from outside the cluster I am wondering how to increase this setting in order to prevent the above error.

Sure, when using an ingress configuration on the service I can stick to the proxy-body-size annotation, but how is it when not using an ingress configuration?


Solution

  • It seems there is no limitation on request-body-size when a service has not defined an ingress resource.

    Edit: Exemplary, we got two services hosted in our cluster A and B. Service A will be reachable from outside the cluster which will be achieved by defining an nginx ingress resource which exposes to the url my.service.a.

    apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    metadata:
      annotations:
        nginx.ingress.kubernetes.io/proxy-body-size: "0"
      ...
    spec:
      rules:
        - host: my.service.a
        http:
          paths:
          ...
    

    Please take note of the annotation nginx.ingress.kubernetes.io/proxy-body-size: "0" which disables the limitation of client request body size (not recommended!).

    Service B will only be requested by Service A within its internal cluster address my-service-b.svc.cluster.local and therefore no nginx ingress resource has been defined for Service B.

    My assumption was, that Service B has by default a client_request_body_size limitation too. But after testing, it seems that there is no limitation.