[英]Kubernetes nginx ingress: set client_max_body_size for one subdomain only
How do I set the client_max_body_size
parameter for a single subdomain? 如何为单个子域设置
client_max_body_size
参数? I have a server that will accept file uploads up to 5TB. 我有一台服务器可以接受高达5TB的文件上传。 All the examples I've looked at show you how to set it globally.
我看过的所有示例都向您展示了如何进行全局设置。 I have multiple rules in my ingress.yaml, I don't want every single rule to inherit the
client_max_body_size
parameter, only the file upload server should. 我的ingress.yaml中有多个规则,我不希望每个规则都继承
client_max_body_size
参数,只有文件上传服务器可以。
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-nginx
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: example.com
http:
paths:
- backend:
serviceName: homepage
servicePort: 80
- host: storage.example.com
http:
paths:
- backend:
serviceName: storage
servicePort: 80
In the above ingress.yaml, I want to set client_max_body_size
for the storage
service only, which is located at the host storage.example.com
. 在上面的ingress.yaml中,我只想为位于主机
storage.example.com
的storage
服务设置client_max_body_size
。
Because I don't see client-max-body-size
on the list of annotations , that leads me to believe you'll have to use the custom-config-snippet to include the client_max_body_size 5tb;
因为我在注释列表中没有看到
client-max-body-size
,所以我认为您必须使用custom-config-snippet来包含client_max_body_size 5tb;
for that Ingress: 对于该Ingress:
metadata:
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
client_max_body_size 5tb;
However, given that you said that you only want it for storage.example.com
, you'll need to split the Ingress config for storage.example.com
out into its own Ingress resource, since (AFAIK) the annotations are applied to every host:
record in the Ingress resource. 但是,假设您只希望将其用于
storage.example.com
,则需要将storage.example.com
的Ingress配置拆分为自己的Ingress资源,因为(AFAIK)注释适用于每个host:
记录在Ingress资源中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.