2

I want to use istio resource EnvoyFilter to change sidecar configurations to support custom max_request_bytes, because we encounter an error 413 when uploading too large file to server. But I am not familiar with envoy configurations.

Is there any one can give me a valid configuration of EnvoyFilter? Thanks!

leo
  • 1,045
  • 3
  • 15
  • 27

3 Answers3

2

On Istio 1.2 and 1.4 this works, but the API was changed and filters has been deprecated:

For the gateway (in the same namespace as the gateways):

---
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

This should work up to 1.6 (tested on 1.4). It will not work in 1.7 without being modified:

---
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

For 1.7 this works:

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
Peter
  • 1,658
  • 17
  • 23
1

This should works on istio 1.13, in this case configured for 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