Forward Traffic to POD in Kubernetes Cluster

8/27/2018

I installed and configured 3 node K8S cluster. The worker nodes are windows nodes. We have one .Net application. We want to containerize this application. This application internally using Apache Ignite for the distributed cache.

We build docker image for this application, wrote a deployment file and deployed it in K8S cluster. The deployment will also create a service of “LoadBalancer” type. 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. One of the POD will be master. We want to always forward the traffic to the POD which is acting as the master node in the Apache Ignite cluster. The Apache Ignite master node identification must be dynamic.

I had gone through the below link. Here the POD configuration is static. We want to dynamically identify the master POD and forward the traffic. What we have to do on the service side.

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.

-- Satya Kada
kubernetes

1 Answer

3/4/2019

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:

  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. 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

-- Raunak Jhawar
Source: StackOverflow