kubesphere 中 Ingress 域名方式导致413 Request Entity Too Large
k8s集群中,将图片或是文件上传到文件服务器上,请求body的长度大于1M是就会报错
413 Request Entity Too Large
解决方案
一、在web的nginx.conf中添加
client_body_buffer_size 50m;
client_max_body_size 100m;
二、在ingress中添加
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/
作者:沐雪
文章均系作者原创或翻译,如有错误不妥之处,欢迎各位批评指正。本文版权归作者和博客园共有,如需转载恳请注明。
如果您觉得阅读这篇博客让你有所收获,请点击右下方【推荐】
为之网-热爱软件编程 http://www.weizhi.cc/