nginx入口成功应用了ConfigMap文件,但没有效果

时间:2018-12-21 04:08:44

标签: nginx kubernetes nginx-ingress

我正在尝试使用以下ConfigMap文件配置nginx-ingress:

apiVersion: v1
data:
  client-body-buffer-size: 32m
  client-max-body-size: 16m
  hsts: "true"
  proxy-body-size: 1g
  proxy-buffering: "false"
  proxy-read-timeout: "600"
  proxy-send-timeout: "600"
  server-tokens: "false"
  ssl-redirect: "false"
  upstream-keepalive-connections: "50"
  use-proxy-protocol: "true"
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"client-body-buffer-size":"32m","client-max-body-size":"16m","hsts":"true","proxy-body-size":"1g","proxy-buffering":"false","proxy-read-timeout":"600","proxy-send-timeout":"600","server-tokens":"false","ssl-redirect":"false","upstream-keepalive-connections":"50","use-proxy-protocol":"true"},"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app":"ingress-nginx"},"name":"nginx-configuration","namespace":"default"}}
  creationTimestamp: 2018-09-28T10:19:23Z
  labels:
    app: ingress-nginx
  name: nginx-configuration
  namespace: default
  resourceVersion: "65855983"
  selfLink: /api/v1/namespaces/default/configmaps/nginx-configuration
  uid: f88fe457-c307-11e8-b14b-42010a800076

但是由于某些原因,至少client-max-body-size配置不起作用-设置默认值为1m。

我可以清楚地看到新配置已在GCP中成功应用,但没有效果。它不起作用的原因可能是什么?

1 个答案:

答案 0 :(得分:0)

您似乎为client-max-body-size使用了错误的选项名称。

我认为您正在寻找documentation所说的proxy-body-size,它是指NGINX的client_max_body_size

所以你想要的是这样的

apiVersion: v1
data:
  client-body-buffer-size: 32m
  proxy-body-size: 16m
  ...
  ...