gpt4 book ai didi

nginx - Kubernetes nginx 入口 Controller 不能上传超过 1mb 的大小

转载 作者:行者123 更新时间:2023-12-05 01:04:14 25 4
gpt4 key购买 nike

我是 GCP 的新手,我有一个用于上传大文件的 URI。
我有一个 ngress-nginx-controller 服务,想将其更改为上传大于 1mb 的文件并设置限制。

apiVersion: v1
kind: Service
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app.kubernetes.io/component":"controller","app.kubernetes.io/instance":"ingress-nginx","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"ingress-nginx","app.kubernetes.io/version":"0.35.0","helm.sh/chart":"ingress-nginx-2.13.0"},"name":"ingress-nginx-controller","namespace":"ingress-nginx"},"spec":{"externalTrafficPolicy":"Local","ports":[{"name":"http","port":80,"protocol":"TCP","targetPort":"http"},{"name":"https","port":443,"protocol":"TCP","targetPort":"https"}],"selector":{"app.kubernetes.io/component":"controller","app.kubernetes.io/instance":"ingress-nginx","app.kubernetes.io/name":"ingress-nginx"},"type":"LoadBalancer"}}
creationTimestamp: "2020-09-21T18:37:27Z"
finalizers:
- service.kubernetes.io/load-balancer-cleanup
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/version: 0.35.0
helm.sh/chart: ingress-nginx-2.13.0
name: ingress-nginx-controller
namespace: ingress-nginx

这是它抛出的错误:

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.19.2</center>
</body>
</html>

最佳答案

如果您需要增加通过入口 Controller 上传的文件的正文大小,则需要为入口资源添加注释:

nginx.ingress.kubernetes.io/proxy-body-size: 8m

此处提供的文档:https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#custom-max-body-size

关于nginx - Kubernetes nginx 入口 Controller 不能上传超过 1mb 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72480039/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com