问题描述
我已经完成了 Istio 1.9 的初始设置并部署了 bookInfo 应用程序来复制 Istio 站点中提供的示例以进行速率限制。因为我们的应用程序中有用例来实现速率限制。我将项目 Istio 作为解决方案,但在运行 Istio 官方链接中提供的 yaml 时我面临挑战。
有人可以帮我吗? https://istio.io/latest/docs/tasks/policy-enforcement/rate-limit/
我已经部署了来自 following link
的 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
应用特使 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。旧版本仍然期待the deprecated filer names:
-
envoy.http_connection_manager
而不是envoy.filters.network.http_connection_manager
-
envoy.router
而不是envoy.filters.http.router
访问记录器、侦听器过滤器、HTTP 过滤器、网络过滤器、统计信息 Sink 和 Tracer 名称已被弃用,以支持扩展 来自特使构建系统的名称。
在分析您的问题时,我偶然发现了几个很好的资源,您会发现它们在学习过程中很有用:
-
当然还有Istio docs
Istio 版本是 1.7。因此我得到了上述错误。我已经升级到 Istio 1.9。然后它开始工作。