mic*_*cha 7 network-programming kubernetes google-kubernetes-engine istio kubernetes-ingress
我想在 Google Kubernetes Engine 中部署许多 Pod,然后通过子域(如 pod-name-or-label.mydomain.com)或路径路由(如 protocol://mydomain.com:7878/pod-)建立到每个特定 Pod 的 TCP 连接名称或标签。
我研究过不同的方向,例如 Istio 或 nginx-ingress,但在我看来这太复杂了。
难道没有一个简单的解决方案吗?
对于Istio,您可以使用VirtualService通过DestinationRules定义来控制到目标子集的路由规则。
DestinationRule将通过指定的标签pod路由到目标Pod。
请求流程将如下:
+--------------------+
| |
| Istio Gateway |
| |
| |
+---------+----------+
|traffic incoming
|
+---------v----------+
| |
| VirtualService |
| |
| |
+---------+----------+
|route to subset by the routing rules
v
+--------------------+
| |
| DestinationRules |
| |
| |
+---------+----------+
|route traffic to target pods
v
+--------------------+
| |
| |
| Pods |
| |
+--------------------+
Run Code Online (Sandbox Code Playgroud)
正如 @ericstaples 所说,您应该使用不同的pod 标签创建不同的部署,以实现分离目标pod 的流量,示例:
s1
子集的流量s1
到目标 Pod 的路由另外,对于公开Gateway ,您可以像 ** Kubernetes** 其他服务一样使用ClusterIP或NodePort ,请参阅Istio Traffic的更多内容。
有一些参考也许会有帮助:
https://istio.io/docs/concepts/traffic-management/
https://istio.io/docs/tasks/traffic-management/request-routing/
归档时间: |
|
查看次数: |
13388 次 |
最近记录: |