k8s集群中,将图片或是文件上传到文件服务器上,请求body的长度大于1M是就会报错
413 Request Entity Too Large
client_body_buffer_size 50m;
client_max_body_size 100m;
annotations:
nginx.ingress.kubernetes.io/proxy-body-size:"50m"
在ingress的annotations下添加相关的参数
kind: Ingress apiVersion: extensions/v1beta1 metadata: name: lys-router namespace: lys-ns annotations: kubesphere.io/alias-name: lys-router kubesphere.io/creator: admin kubesphere.io/description: 控制台路由 nginx.ingress.kubernetes.io/proxy-body-size: 102400m nginx.ingress.kubernetes.io/proxy-connect-timeout: '300' nginx.ingress.kubernetes.io/proxy-read-timeout: '300' nginx.ingress.kubernetes.io/proxy-send-timeout: '300'spec: tls: - hosts: - nginx.lys.com secretName: my-crt-secret rules: - host: cv.sugon.tech http: paths: - path: / pathType: ImplementationSpecific backend: serviceName: web-main servicePort: 80
在kubesphere中的路径为:
项目---》应用负载----》应用路由:
参考:
https://cloud.tencent.com/developer/article/1586810
https://blog.pragtechnologies.com/file-upload-limit-in-kubernetes/