簡體   English   中英

Istio1.9 中的速率限制功能實現

[英]Rate limit feature implementation in Istio1.9

我已經完成了 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

正如前面評論中所懷疑的那樣,問題是由於使用了舊版本的 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 構建系統中的擴展名稱。

在分析您的問題時,我偶然發現了幾個很好的資源,您會在學習時發現它們很有用:

Istio 版本是 1.7。 因此,我得到了上述錯誤。 我已經升級到 Istio 1.9。 然后它開始工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM