k8s集群中,上传图片时,大于1M就会报错 413 Request Entity Too Large
Nginx Ingress Controller 的版本是 0.29.0
kubectl edit configmap nginx-configuration -n ingress-nginx
在 ConfigMap 的 data 字段中设置参数:
data:
proxy-body-size: "30m"
示例:
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-configuration
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
data:
proxy-body-size: "30m"
kubectl delete pod -n ingress-nginx [nginx-ingress-controller-pod-name]
查看nginx配置中client_max_body_size的值
kubectl exec -n ingress-nginx [nginx-ingress-controller-pod-name] -- cat /etc/nginx/nginx.conf