Istio从入门到精通—— 流量治理的原理 —— VirutalService —— L4MatchAttributes

流量治理的原理 —— VirutalService —— L4MatchAttributes

https://istio.io/latest/docs/reference/config/networking/virtual-service/#L4MatchAttributes

L4 connection match attributes. Note that L4 connection matching support is incomplete.

L4连接匹配属性。请注意,L4连接匹配支持不完善。

我的理解是:L4 连接匹配属性(L4MatchAttributes) 在 Istio 中,L4 连接匹配属性用于在入站流量上进行匹配。这使得您可以基于源和目标端口、协议、地址范围、标志位等进行流量路由。 例如,您可能希望根据目标端口将流量路由到不同的后端服务。在这种情况下,您可以使用 L4 连接匹配属性来定义匹配规则。

我的理解是:L4 连接匹配支持不完善,通常意味着 Istio 的某些功能或配置在 L4 层面上可能存在问题。

Field Type Description Required
destinationSubnets string[]

IPv4 or IPv6 ip addresses of destination with optional subnet. E.g., a.b.c.d/xx form or just a.b.c.d.

指定一个目标 IP 地址,这个地址可以是 IPv4 或 IPv6,可以有可选的子网部分例如,a.b.c.d/xx 形式或只是 a.b.c.d。

No
port uint32

Specifies the port on the host that is being addressed. Many services only expose a single port or label ports with the protocols they support, in these cases it is not required to explicitly select the port.

指定正在访问的主机上的端口。许多服务只暴露一个端口或用它们支持的协议标记端口,在这些情况下,不需要显式选择端口。

No
sourceLabels map<string, string>

One or more labels that constrain the applicability of a rule to workloads with the given labels. If the VirtualService has a list of gateways specified in the top-level gateways field, it should include the reserved gateway mesh in order for this field to be applicable.

一个或多个标签,用于约束规则对具有给定标签的工作负载的适用性。如果 VirtualService 在顶级 gateways 字段中指定了网关列表,则它应该包含保留的 gateway mesh,以便该字段适用。

No
gateways string[]

Names of gateways where the rule should be applied. Gateway names in the top-level gateways field of the VirtualService (if any) are overridden. The gateway match is independent of sourceLabels.

需要指定哪些网关应该应用这个规则。VirtualService(如果有)中的顶级网关字段中的网关名称将被覆盖。网关匹配与sourceLabels无关。

我的理解是:在 VirtualService 中定义的网关名称会覆盖在顶级 gateways 字段中定义的任何网关名称,而网关匹配的过程则不受 sourceLabels 的影响。

No
sourceNamespace string

Source namespace constraining the applicability of a rule to workloads in that namespace. If the VirtualService has a list of gateways specified in the top-level gateways field, it must include the reserved gateway mesh for this field to be applicable.

source namespace 限制了规则在该 namespace 中工作负载的适用性。如果 VirtualService 在顶级 gateways 字段中指定了网关列表,则必须包含为该字段保留的 gateway mesh,以使该规则适用。

No
posted @ 2023-12-18 16:29  左扬  阅读(21)  评论(0编辑  收藏  举报
levels of contents