Nginx.ingress.kubernetes.io/proxy-body-size不起作用 [英] Nginx.ingress.kubernetes.io/proxy-body-size not working

查看:1981
本文介绍了Nginx.ingress.kubernetes.io/proxy-body-size不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想增加Ingress中每个请求的帖子正文的大小.所以我添加了

I want to increase size of post body of each request in Ingress. So I add the

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

在yaml文件入口中(在rancher的视图/编辑yaml文件中),但是它不起作用.当我使用kubectl获取入口的描述时,我没有看到添加的注释,但是看到了新添加的映射. 这是配置:

in yaml file ingress(in view/edit yaml file of rancher) but it doesn’t work. When I get the describe of ingress with kubectl I dont see the added annotation but i see the new added mapping. Hereis the configs:

YAML文件:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/configuration-snippet: |-
      set $test_host "testdms.test.com"
      if ($host == $test_host) {
        return 301 $scheme://$test_host/webui/;
      }
    nginx.ingress.kubernetes.io/proxy-body-size: 8m
  creationTimestamp: 2018-09-11T12:19:02Z
  generation: 116
  name: test-dms
  namespace: test-dms
  resourceVersion: "95490045"
  selfLink: /apis/extensions/v1beta1/namespaces/test-dms/ingresses/test-dms
  uid: de7c4c1b-b5bc-11e8-84c0-005056bf6431
spec:
  rules:
  - host: testdms.test.com
    http:
      paths:
      - backend:
          serviceName: ingress-e5a45b0dc688c653b79d4b5942ebbe7c
          servicePort: 80
        path: /test
status:
  loadBalancer:
    ingress:
    - {}
    - ip: 198.100.101.171
    - ip: 198.100.101.172
    - ip: 198.100.101.173
    - ip: 198.100.101.61

描述结果:

Annotations:
  configuration-snippet:  set $test_host "testdms.test.com"
if ($host == $test_host) {
  return 301 $scheme://$test_host/webui/;
}
Events:
  Type    Reason  Age                       From                      Message
  ----    ------  ----                      ----                      -------
  Normal  UPDATE  36s (x38 over 2h)         nginx-ingress-controller  Ingress test-dms/test-dms
  Normal  UPDATE  21s (x47 over 23d)        nginx-ingress-controller  Ingress test-dms/test-dms
  Normal  UPDATE  <invalid> (x47 over 23d)  nginx-ingress-controller  Ingress test-dms/test-dms
  Normal  UPDATE  <invalid> (x84 over 64d)  nginx-ingress-controller  Ingress test-dms/test-dms
  Normal  UPDATE  <invalid> (x39 over 12d)  nginx-ingress-controller  Ingress test-dms/test-dms

推荐答案

K8中对入口对象的修改有时行为不当,因此建议重新创建而不是编辑.

Amendment of the ingress objects in K8s sometimes misbehave, so it's recommended to re-create rather than edit.

如果仍然无法使用,请尝试使用configmap为所有入口规则全局设置此值

If it still didn't work, try to set this value globally for all ingress rules using a configmap

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: nginx
      namespace: ingress-nginx
      labels:
        app: ingress-nginx
    data:
      proxy-body-size: "8m"

这篇关于Nginx.ingress.kubernetes.io/proxy-body-size不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆