我想在Ingress中增加每个请求的post body的大小。所以我加上
nginx.ingress.kubernetes.io/proxy-body-size: 8m
在yaml文件入口(在查看/编辑yaml文件的牧场主),但它不工作.当我使用kubectl获取ingress的描述时,我没有看到添加的注解,但我看到了新添加的Map。以下是这些问题:
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
4条答案
按热度按时间yfwxisqw1#
您需要添加引号(例如,
"8m"
),如下所示:f87krz0w2#
修改K8中的入口对象有时会出现错误,因此建议重新创建而不是编辑。
如果仍然不起作用,请尝试使用一个Map表为所有入口规则全局设置此值
ssgvzors3#
注解
被忽略可能是使用nginx-ingress控制器的错误实现的结果。我不确定是不是这样,在这里。您使用的是哪个实现?
详情请参见this answer by ololoepepe。
t2a7ltrp4#
注解似乎在新的实现中发生了变化,所以你可以尝试:
https://docs.nginx.com/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-annotations