gpt4 book ai didi

kubernetes - 服务网格 : Using Istio to route TCP traffic based on Client IP in Virtual Service

转载 作者:行者123 更新时间:2023-12-02 12:01:05 24 4
gpt4 key购买 nike

入口网关位于使用 nodeport 的 AWS ELB(经典)后面,我想根据客户端 IP 在虚拟服务中路由 TCP 流量。

当然 ELB 的代理协议(protocol)是启用的。

当我使用 HTTP 时,它可以工作。配置如下。

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: app-vservice
namespace: test
spec:
hosts:
- "app-service"
http:
- match:
- headers:
x-forwarded-for:
exact: 123.123.123.123
route:
- destination:
host: app-service
subset: v2
- route:
- destination:
host: app-service
subset: v1

但是我在官方文档中找不到 TCP 路由的 headers 字段。

这是不可能的吗?

谢谢你。

最佳答案

根据文档,是的,在 Istio 的 TCPRoute 中没有传递 header 的字段。另外要回答您的问题,应该使用 envoy 过滤器完成每个 header 操作,因为基于 envoy 构建的 Istio 支持这一点并且还降低了复杂性。

使用 Istio 文档中所述的 envoy 和 lua 过滤器。这是可以实现的。请关注特使docs .

查看 Istio Discussion用于虚拟服务中的 header 。

使用 Lua 来实现相同的功能.还有一个 blog展示如何在特使上实现过滤器的示例。

关于kubernetes - 服务网格 : Using Istio to route TCP traffic based on Client IP in Virtual Service,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62207744/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com