I am testing hosting a docker repo on a cluster (nexus3) where routing to the docker service is using Ingress.
Everything seems to work except:
604cbde1a4c8: Pushing [==================================================>] 101.7MB/101.7MB
error parsing HTTP 413 response body: invalid character ‘<’ looking for beginning of value: “\r\n413 Request Entity Too Large\r\n\r\n
413 Request Entity Too Large
\r\nnginx/1.15.6\r\n\r\n\r\n”
Looks like I need to modify the “client_max_body_size” parameter. According to stock Kubernetes docs, there are 2 ways to do that:
Using an annotation on the Ingress object for a per-ingress setting
Editing the configMap for nginx-config (or “nginx-configuration”, as Rancher seems to call it by default)
Neither option has worked for me. Whether I add a data item to nginx-configuration (and kill the pods to force them to re-load), or if I add the nginx.org/client-max-body-size annotation to my Ingress, I exec a /bin/sh shell on one of the nginx pods and always see under my ingress object’s config clause:
…
# enforce ssl on server side
if ($redirect_to_https) {
return 308 https://$best_http_host$request_uri;
}
client_max_body_size 1m;
proxy_set_header Host $best_http_host;
# Pass the extracted client certificate to the backend
# Allow websocket connections
proxy_set_header Upgrade $http_upgrade;
…
So how do you tune those parameters correctly with Rancher-deployed kubernetes?
The ConfigMap attribute is “proxy-body-size” in this case and it works:
–
$ grep client_max_body_size *
grep: geoip: Is a directory
grep: lua: Is a directory
grep: modsecurity: Is a directory
grep: modules: Is a directory
nginx.conf: client_max_body_size 1024m;
nginx.conf: client_max_body_size 1024m;
nginx.conf: client_max_body_size 1024m;
nginx.conf: client_max_body_size 10m;
grep: owasp-modsecurity-crs: Is a directory
grep: template: Is a directory
In my setup I have added the annotation nginx.ingress.kubernetes.io/proxy-body-size: 50m to the ingrtess definition, as documented in the link to the nginx ingress annotations you mentioned above. I have also had some success in the past using the following command: