istio - 应用于特定工作负载的 Istio EnvoyFilter
问题描述
我正在尝试将 EnvoyFilter (istio 1.8.3) 应用于专用命名空间中的特定部署我找到了一种将其应用于所有传入流量的方法,但不适用于 1 个特定应用程序这是一个适用于所有流量的工作解决方案
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: filter-api-extauth
namespace: istio-system
spec:
workloadSelector:
labels:
istio: ilbgateway
configPatches:
- 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
value:
name: envoy.filters.http.ext_authz
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
http_service:
server_uri:
cluster: outbound|80||auth-server.public-api-poc.svc.cluster.local
uri: http://auth-server.public-api-poc.svc.cluster.local
timeout: 0.25s
failure_mode_allow: false
authorizationRequest:
allowedHeaders:
patterns:
- exact: "authorization"
我尝试SNI
将 EnvoyFilter 部署到应用程序命名空间,并设置集群 - 无济于事这是最后一次尝试
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: filter-mtapi-extauth
namespace: public-api-poc
spec:
workloadSelector:
labels:
role: api
configPatches:
- applyTo: VIRTUAL_HOST
match:
routeConfiguration:
name: "inbound|5000||"
vhost:
name: "public.api.dev.poc.net:443"
route:
name: "default"
patch:
operation: INSERT_FIRST
value:
name: envoy.filters.http.ext_authz
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
http_service:
server_uri:
cluster: outbound|80||auth-server.public-api-poc.svc.cluster.local
uri: http://auth-server.public-api-poc.svc.cluster.local
timeout: 0.25s
failure_mode_allow: false
authorizationRequest:
allowedHeaders:
patterns:
- exact: "authorization"
所以区别在于match
块。如何将 EnvoyFilter 指向特定命名空间中的特定部署?
我已经检查了应用程序 pod 的转储配置,我看到了修补的路由和集群但是身份验证仍然无法正常工作
解决方案
推荐阅读
- ruby-on-rails - Faker 名称生成重复是否可能?
- c# - C# 程序中使用的 SQL 语句无法识别数据库“System.Data.SqlClient.SqlException (0x80131904): Showing Invalid object name 'CDA'。”
- android - 视频流在本机反应中接收
- javascript - Sequelize 不能包含 count 属性
- python - 在 django 中使用 distinct 方法时如何使用过滤数据?
- sql - 带有条件的 Spark SQL 窗口函数范围边界
- r - 对日期列表进行排序并根据 R 中的此排序顺序对其他列表进行排序
- nativescript - Nativescript-vue 获取有焦点的TextField
- java - 方法意外返回 null
- c# - 如何检查 BsonDocument 中是否存在密钥或不使用 Mongodb C# 驱动程序?