简体   繁体   English

将流量转发到Kubernetes集群中的POD

[英]Forward Traffic to POD in Kubernetes Cluster

I installed and configured 3 node K8S cluster. 我安装并配置了3节点K8S集群。 The worker nodes are windows nodes. 工作节点是Windows节点。 We have one .Net application. 我们有一个.Net应用程序。 We want to containerize this application. 我们要容器化此应用程序。 This application internally using Apache Ignite for the distributed cache. 该应用程序内部使用Apache Ignite进行分布式缓存。

We build docker image for this application, wrote a deployment file and deployed it in K8S cluster. 我们为此应用程序构建docker映像,编写了一个部署文件并将其部署在K8S集群中。 The deployment will also create a service of “LoadBalancer” type. 部署还将创建“ LoadBalancer”类型的服务。 Using this service we are connecting to the application from the outside world. 使用此服务,我们可以从外部连接到应用程序。 All is good so far. 到目前为止一切都很好。

Coming to the issue, as we are using Apache Ignite for the distributed cache. 即将出现问题,因为我们将Apache Ignite用于分布式缓存。 One of the POD will be master. POD之一将是主服务器。 We want to always forward the traffic to the POD which is acting as the master node in the Apache Ignite cluster. 我们希望始终将流量转发到充当Apache Ignite集群中的主节点的POD。 The Apache Ignite master node identification must be dynamic. Apache Ignite主节点标识必须是动态的。

I had gone through the below link. 我已经通过以下链接。 Here the POD configuration is static. 在此POD配置是静态的。 We want to dynamically identify the master POD and forward the traffic. 我们要动态识别主POD并转发流量。 What we have to do on the service side. 我们在服务方面必须要做的。

https://appscode.com/products/voyager/7.4.0/guides/ingress/http/statefulset-pod/ https://appscode.com/products/voyager/7.4.0/guides/ingress/http/statefulset-pod/

Any help on how to forward the traffic to the POD is greatly appreciated. 非常感谢有关如何将流量转发到POD的任何帮助。

The very fact that you have a leader/follower topology, the ask to direct traffic to a said nome (master node) is flawed for a couple of reasons: 事实上,您具有领导者/从属者拓扑,将流量定向到所述nome(主节点)的要求存在缺陷,其原因有两个:

  1. What happens when the current leader fails over and there is a new election to select a new leader 当前领导者进行故障转移并且有新的选举来选择新领导者时会发生什么
  2. The fact that pods are ephemeral they should not have major roles to play in production, instead work with deployments and their replicas. Pod是临时性的,它们不应在生产中扮演主要角色,而应与部署及其副本一起使用。 What you are trying to achieve is an anti-pattern 您要实现的是反模式

In any case, if this is what you want, may be you want to read about gateways in istio which can be found here 无论如何,如果这是您想要的,也许您想阅读有关gateways in istio中的gateways in istio ,可以在这里找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM