我想使用istio资源EnvoyFilter
来更改sidecar配置以支持自定义max_request_bytes
,因为我们在将过大的文件上传到服务器时遇到错误413。但我不熟悉特使的配置。
有人能给我一个有效的EnvoyFilter
配置吗?谢谢
在Istio 1.2和1.4上,这是有效的,但API已被更改,filters
已被弃用:
对于网关(在与网关相同的命名空间中(:
---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: request-size-limit
spec:
filters:
- listenerMatch:
listenerType: GATEWAY
listenerProtocol: HTTP
filterName: envoy.buffer
filterType: HTTP
filterConfig:
maxRequestBytes: 26214400 # 25MB
这个应该工作到1.6(在1.4上测试(。如果不进行修改,它将无法在1.7中工作:
---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: request-size-limit
namespace: istio-system
spec:
configPatches:
- applyTo: HTTP_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
patch:
operation: INSERT_BEFORE
value:
name: envoy.buffer
config:
maxRequestBytes: 26214400 # 25MB
对于1.7,这是有效的:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: request-size-limit
namespace: istio-system
spec:
workloadSelector:
labels:
istio: ingressgateway
configPatches:
- applyTo: HTTP_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
patch:
operation: INSERT_BEFORE
value:
name: envoy.buffer
typed_config:
'@type': type.googleapis.com/udpa.type.v1.TypedStruct
value:
maxRequestBytes: 1048576 # 1 MB
这应该适用于istio 1.13,在本例中配置为50MB
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: size-limit
namespace: istio-external
spec:
workloadSelector:
labels:
istio: external
app: external
configPatches:
- applyTo: HTTP_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: "envoy.filters.network.http_connection_manager"
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.buffer
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.buffer.v3.Buffer
maxRequestBytes: 50000000