feat: readme
This commit is contained in:
46
nginx-ingress常见问题.md
Normal file
46
nginx-ingress常见问题.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# nginx-ingress常见问题
|
||||
|
||||
nginx-ingress相比较与traefik-ingress,对开发者而言貌似少了一些亲和力
|
||||
|
||||
很多东西都要自己配置
|
||||
|
||||
|
||||
**413报错**
|
||||
|
||||
就是上传的文件大小超过限制的报错
|
||||
|
||||
今天在捣鼓自己的仓库的时候发现的,命名中转服务器设置了
|
||||
```
|
||||
client_max_body_size 0;
|
||||
```
|
||||
但是还是出现413的报错,那么问题就出在集群的nginx-ingress了
|
||||
|
||||
查看日志定位了问题
|
||||
|
||||
2025/10/16 08:08:59 [error] 4876#4876: *2094938 client intended to send too large body: 288100865 bytes, client: 10.0.0.1, server:....
|
||||
|
||||
于是去网上查找解决方案:
|
||||
|
||||
### 配置ingress
|
||||
```
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: gitea
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: "500m"
|
||||
```
|
||||
|
||||
给对应服务的ingress添加annotation: nginx.ingress.kubernetes.io/proxy-body-size: "500m"
|
||||
|
||||
个人认为这是比较好的方法,对上传文件大小做更细的划分
|
||||
|
||||
还有一种配置全局的:
|
||||
|
||||
### 配置configmap
|
||||
```
|
||||
data:
|
||||
proxy-body-size: 500m
|
||||
```
|
||||
找到对应的configmap,根据[官方文档](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#proxy-body-size)中的表述,解决413报错需要配置proxy-body-size,覆盖原有默认配置,默认值只有1M
|
||||
|
||||
Reference in New Issue
Block a user