On premise: Can not understand how external ips works

7/15/2019

We have on-prem kubernetes cluster set up with 1 master and 2 workers and metallb with calico networking. Issue is that our application is not opening from outside world.

I can curl external IP from my K8S cluster but can’t open the same from browser.

The IP range of master & worker nodes is different from config map address pool -

Master/worker node --> a.b.c.d

Metallb config.yaml -->

apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- w.x.y.z

I want to know if the address range in metallb config.yaml needs to be same as cluster network? Because when I give kubernetes cluster IP range, the application opens from outside, otherwise not.

-- Anuj G
docker
kubernetes
metallb

2 Answers

12/30/2019

In Layer 2 mode the IP address range you give to metallb should be within the cluster node network range. You need the IP packet originating external to cluster to reach the cluster subnet first. Then the endpoint(probably a router connecting the cluster subnet to external network) that received the traffic destined to the virtual IP assigned by metallb can do an ARP request to figure out the MAC address of the interface on node that currently owns the virtual IP. This is how the external packet gets routed.

-- Shashank V
Source: StackOverflow

7/15/2019

To use MetalLB, your assign IPs range must be reachable from your cluster network. For example if your cluster IP is 192.168.1.0 /24 you can assign IPs from range 192.168.1.1 - 192.168.1.254

So if you will specify in ConfigMap

...
addresses:
      - 192.168.1.1-192.168.1.254

it will work.

However if you will set cluster IP for example 192.168.1.0/28 you will be able to use addresses only from range 192.168.1.1-192.168.1.14.

Please remember that network configruation and proper ConfigMap is not all. You have to create service(loadbalancer) which will expose your cluster to the world.

Please check this MetalLB tutorial. It contains example of proper MetalLB set.

-- PjoterS
Source: StackOverflow