nginx-ingress-controller限制上传文件大小问题

参考:
https://www.cnblogs.com/pitaiyang/p/17975041

  1. 报错信息
    nginx-ingress-controller限制上传文件大小为1M如果上传文件大于1M则会在浏览器报以下错误
# Request Entity Too Large
  1. 解决方法
    修改ingress配置文件增加以下配置
 annotations:
    #nginx.org/client-max-body-size: "4096m"
    nginx.ingress.kubernetes.io/proxy-body-size: 4096m

一个完整的配置文件如下

# cat ingress.yaml 
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  generation: 1
  name: ingress
  namespace: default
  annotations:
    #nginx.org/client-max-body-size: "4096m"
    nginx.ingress.kubernetes.io/proxy-body-size: 4096m
spec:
  rules:
  - host: test.com
    http:
      paths:
      - backend:
          serviceName: test
          servicePort: 80
        path: /

2024-05-07补充
针对Ingress代理的Gitlab也有效

posted @ 2024-03-18 17:39  minseo  阅读(402)  评论(0编辑  收藏  举报