繁体   English   中英

Kubernetes Nginx入口:仅为一个子域设置client_max_body_size

[英]Kubernetes nginx ingress: set client_max_body_size for one subdomain only

如何为单个子域设置client_max_body_size参数? 我有一台服务器可以接受高达5TB的文件上传。 我看过的所有示例都向您展示了如何进行全局设置。 我的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

在上面的ingress.yaml中,我只想为位于主机storage.example.comstorage服务设置client_max_body_size

因为我在注释列表中没有看到client-max-body-size ,所以我认为您必须使用custom-config-snippet来包含client_max_body_size 5tb; 对于该Ingress:

metadata:
  annotations:
    nginx.ingress.kubernetes.io/configuration-snippet: |
      client_max_body_size 5tb;

但是,假设您只希望将其用于storage.example.com ,则需要将storage.example.com的Ingress配置拆分为自己的Ingress资源,因为(AFAIK)注释适用于每个host:记录在Ingress资源中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM