New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

413 Request Entity Too Large #21

Closed
rawlingsj opened this Issue Apr 25, 2016 · 12 comments

Comments

Projects
None yet
7 participants
@rawlingsj

rawlingsj commented Apr 25, 2016

We've deployed a docker registry and created an ingress rule to it's kubernetes service whilst using the nginx ingress controller. When pushing larger images we quickly hit the nginx limits giving us the error below.

Error parsing HTTP response: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>413 Request Entity Too Large</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>413 Request Entity Too Large</h1></center>\r\n<hr><center>nginx/1.9.14</center>\r\n</body>\r\n</html>\r\n"

I've forked the repo and hacked the nginx config adding a client_max_body_size attribute so we can push larger images. For a proper solution though, it might be nice to set a value in the kubernetes ingress rule and have that used when the nginx controller is updated?

@pleshakov

This comment has been minimized.

Show comment
Hide comment
@pleshakov

pleshakov Apr 25, 2016

Collaborator

We plan to add the ability to configure the global NGINX parameters through a ConfigMap.

To allow to customize the configuration per Ingress resource, we can leverage annotations. As an example,

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cafe-ingress
  annotations:
    nginx/client_max_body_size: 1m
spec:
  rules:
  - host: cafe.example.com
    http:
      paths:
      - path: /tea
        backend:
          serviceName: tea-svc
          servicePort: 80
      - path: /coffee
        backend:
          serviceName: coffee-svc
          servicePort: 80

Will that work for your case?

Collaborator

pleshakov commented Apr 25, 2016

We plan to add the ability to configure the global NGINX parameters through a ConfigMap.

To allow to customize the configuration per Ingress resource, we can leverage annotations. As an example,

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cafe-ingress
  annotations:
    nginx/client_max_body_size: 1m
spec:
  rules:
  - host: cafe.example.com
    http:
      paths:
      - path: /tea
        backend:
          serviceName: tea-svc
          servicePort: 80
      - path: /coffee
        backend:
          serviceName: coffee-svc
          servicePort: 80

Will that work for your case?

@rawlingsj

This comment has been minimized.

Show comment
Hide comment
@rawlingsj

rawlingsj Apr 25, 2016

@pleshakov yeah that would be great!

rawlingsj commented Apr 25, 2016

@pleshakov yeah that would be great!

@styxlab

This comment has been minimized.

Show comment
Hide comment
@styxlab

styxlab May 31, 2016

This already works with ConfigMaps such as:

apiVersion: v1
kind: ConfigMap
data:
  body-size: "0"
metadata:
  name: nginx-conf

A value of "0" lifts the restriction on client_max_body_size.
Make sure to reference the ConfigMap in your ingress controller like so:

args:
        - /nginx-ingress-controller
        - --default-backend-service=default/default-http-backend
        - --nginx-configmap=default/nginx-conf

For more information on the available config parameters have a look at here.

styxlab commented May 31, 2016

This already works with ConfigMaps such as:

apiVersion: v1
kind: ConfigMap
data:
  body-size: "0"
metadata:
  name: nginx-conf

A value of "0" lifts the restriction on client_max_body_size.
Make sure to reference the ConfigMap in your ingress controller like so:

args:
        - /nginx-ingress-controller
        - --default-backend-service=default/default-http-backend
        - --nginx-configmap=default/nginx-conf

For more information on the available config parameters have a look at here.

@pleshakov

This comment has been minimized.

Show comment
Hide comment
@pleshakov

pleshakov Jun 1, 2016

Collaborator

We're adding this features as well as other NGINX configuration parameters soon. Stay tuned.

Collaborator

pleshakov commented Jun 1, 2016

We're adding this features as well as other NGINX configuration parameters soon. Stay tuned.

@pleshakov

This comment has been minimized.

Show comment
Hide comment
@pleshakov

pleshakov Jun 16, 2016

Collaborator

customization of NGINX configuration was added in #33

Collaborator

pleshakov commented Jun 16, 2016

customization of NGINX configuration was added in #33

@pleshakov pleshakov closed this Jun 16, 2016

@pleshakov

This comment has been minimized.

Show comment
Hide comment
@pleshakov
Collaborator

pleshakov commented Jun 16, 2016

@Hronom

This comment has been minimized.

Show comment
Hide comment
@Hronom

Hronom Feb 22, 2017

Not worked in gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.2 and gcr.io/google_containers/nginx-ingress-controller:0.8.3 I set value like this:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.org/client-max-body-size: "100m"
spec:
  rules:
  - host: test.com
    http:
      paths:
      - path: /
        backend:
          serviceName: test
          servicePort: 8888

Hronom commented Feb 22, 2017

Not worked in gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.2 and gcr.io/google_containers/nginx-ingress-controller:0.8.3 I set value like this:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.org/client-max-body-size: "100m"
spec:
  rules:
  - host: test.com
    http:
      paths:
      - path: /
        backend:
          serviceName: test
          servicePort: 8888
@pleshakov

This comment has been minimized.

Show comment
Hide comment
@pleshakov

pleshakov Feb 23, 2017

Collaborator

@Hronom the google_containers/nginx-ingress-controller images belong to a different project. Please see the documentation for that project available on this page https://github.com/kubernetes/ingress/blob/master/controllers/nginx/configuration.md

The image for this project -- https://hub.docker.com/r/nginxdemos/nginx-ingress/tags/

Collaborator

pleshakov commented Feb 23, 2017

@Hronom the google_containers/nginx-ingress-controller images belong to a different project. Please see the documentation for that project available on this page https://github.com/kubernetes/ingress/blob/master/controllers/nginx/configuration.md

The image for this project -- https://hub.docker.com/r/nginxdemos/nginx-ingress/tags/

@Hronom

This comment has been minimized.

Show comment
Hide comment
@Hronom

Hronom Feb 23, 2017

@pleshakov sorry guys, too many kubernetes ingresses over internet...

Hronom commented Feb 23, 2017

@pleshakov sorry guys, too many kubernetes ingresses over internet...

@misteruly

This comment has been minimized.

Show comment
Hide comment
@misteruly

misteruly Aug 28, 2017

@Hronom I'm setting it like that, but it doesn't work.don't know why??

misteruly commented Aug 28, 2017

@Hronom I'm setting it like that, but it doesn't work.don't know why??

@benbonnet

This comment has been minimized.

Show comment
Hide comment
@benbonnet

benbonnet Nov 27, 2017

In case it helps, 413 solved with the ingress.kubernetes.io/proxy-body-size :

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: services
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/proxy-body-size: 50m

Running quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0-beta.17

benbonnet commented Nov 27, 2017

In case it helps, 413 solved with the ingress.kubernetes.io/proxy-body-size :

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: services
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/proxy-body-size: 50m

Running quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0-beta.17

@lastcoolnameleft

This comment has been minimized.

Show comment
Hide comment
@lastcoolnameleft

lastcoolnameleft Jul 28, 2018

FYI, the annotation has changed and is now:

    nginx.ingress.kubernetes.io/proxy-body-size: 50m

Also, I had to restart the nginx pod for the effect to take place. It immediately started working after that.

lastcoolnameleft commented Jul 28, 2018

FYI, the annotation has changed and is now:

    nginx.ingress.kubernetes.io/proxy-body-size: 50m

Also, I had to restart the nginx pod for the effect to take place. It immediately started working after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment