2

我已经完成了 Istio 1.9 的初始设置并部署了 bookInfo 应用程序以复制 Istio 站点中提供的示例以进行速率限制。正如我们在应用程序中有实现速率限制的用例一样。我将 Istio 项目作为解决方案,但在运行 Istio 官方链接本身提供的 yaml 时面临挑战。

在此处输入图像描述 有人可以帮帮我吗? https://istio.io/latest/docs/tasks/policy-enforcement/rate-limit/

我已经从以下链接部署了 bookinfo 示例

特使 YAML

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: filter-ratelimit
  namespace: istio-system
spec:
  workloadSelector:
    # select by label in the same namespace
    labels:
      istio: ingressgateway
  configPatches:
    # The Envoy config you want to modify
    - applyTo: HTTP_FILTER
      match:
        context: GATEWAY
        listener:
          filterChain:
            filter:
              name: "envoy.filters.network.http_connection_manager"
              subFilter:
                name: "envoy.filters.http.router"
      patch:
        operation: INSERT_BEFORE
        # Adds the Envoy Rate Limit Filter in HTTP filter chain.
        value:
          name: envoy.filters.http.ratelimit
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit
            # domain can be anything! Match it to the ratelimter service config
            domain: productpage-ratelimit
            failure_mode_deny: true
            rate_limit_service:
              grpc_service:
                envoy_grpc:
                  cluster_name: rate_limit_cluster
                timeout: 10s
              transport_api_version: V3
    - applyTo: CLUSTER
      match:
        cluster:
          service: ratelimit.default.svc.cluster.local
      patch:
        operation: ADD
        # Adds the rate limit service cluster for rate limit service defined in step 1.
        value:
          name: rate_limit_cluster
          type: STRICT_DNS
          connect_timeout: 10s
          lb_policy: ROUND_ROBIN
          http2_protocol_options: {}
          load_assignment:
            cluster_name: rate_limit_cluster
            endpoints:
            - lb_endpoints:
              - endpoint:
                  address:
                     socket_address:
                      address: ratelimit.default.svc.cluster.local
                      port_value: 8081

应用 envoy yaml 时出错:

Error from server: error when creating "envoyfilter.yaml": admission webhook "validation.istio.io" denied the request: configuration is invalid: Envoy filter: subfilter match requires filter match with envoy.http_connection_manager
4

2 回答 2

2

正如前面评论中所怀疑的那样,问题是由于使用了旧版本的 Istio (1.7) 而不是预期的 1.9。旧版本仍然期待弃用的文件管理器名称

  • envoy.http_connection_manager代替envoy.filters.network.http_connection_manager

  • envoy.router代替envoy.filters.http.router

Access Logger、Listener Filter、HTTP Filter、Network Filter、Stats Sink 和 Tracer 名称已被弃用,取而代之的是 envoy 构建系统中的扩展名称。

在分析您的问题时,我偶然发现了几个很好的资源,您会在学习时发现它们很有用:

于 2021-04-01T12:23:40.090 回答
0

Istio version was 1.7. Due to which i got above error. i have upgraded to Istio 1.9. then it started working.

于 2021-03-31T14:38:59.937 回答