How to access K8s's flannel network from outside

7/26/2018

I have a K8s setup 1 master and 1 minion. I want to load balance the traffic with external load balancer(HaProxy) manually on pods. For that I decided to use "Headless Service" to get direct POD IPs.

Now there is a 3rd node(Load Balancer) needs to access the POD or flannel over rely network. Is there any way to join the 3rd node in flannel network of K8s setup. Or can I add any routes to redirect the traffic to flannel network.

P.S K8s setup(1 Master + 1 Minion) and 3rd Node(load balancer) are in same subnet.

-- Veerendra Kakumanu
flannel
flanneld
kubernetes
load-balancing

1 Answer

7/26/2018

You may check out the HAProxy ingress controller:

HAProxy is extremely fast and resource-efficient allowing you to get the most out of your infrastructure and minimize latencies in high-traffic scenarios. It also brings an almost endless list of options for tuning and customization. HAProxy’s features like dynamic scaling and reconfiguration without reloading are also very valuable in this use case as Kubernetes pods are often spawned, terminated, and migrated in quick bursts and in high amounts, especially during deployments.

We will use the HAProxy Ingress Controller implementation available at jcmoraisjr/haproxy-ingress. It is a project to which HAProxy Technologies has contributed code that enables the Ingress Controller to take advantage of the HAProxy Runtime API. (Another useful HAProxy Ingress Controller implementation that you could look into would be appscode/voyager.)

The main advantage of this solution is that the HAProxy ingress controller runs natively inside the Kubernetes cluster, and can be easily configured using ConfigMap. It means that HAProxy ingress controller will use the Flannel overlay network without any additional configuration.

This manual could be helpful if you decide to give it a try:

Update:
If you want to use Flannel on the instances outside of the cluster consider reading this manual:

-- VAS
Source: StackOverflow