apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx-container image: nginx:latest ports: - containerPort: 80 volumeMounts: - mountPath: /etc/nginx/conf.d name: nginx-config - mountPath: /usr/share/nginx/html name: nginx-html volumes: - name: nginx-config configMap: name: nginx-config - name: nginx-html persistentVolumeClaim: claimName: nginx-pvc ...
在配置中添加以下行:
nginx.conf
http { ... client_max_body_size 100M; ... }
client_max_body_size将允许上传的文件大小达到100MB。
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-ingress annotations: nginx.ingress.kubernetes.io/proxy-body-size: 100m spec: rules:
此配置将客户端上传的文件大小限制为100MB。