LoadBalancer and external IP

metallb
loadbalancer

#1

Hey guys, i need your help.

I am running a kubernetes cluster with one master and one node.

I am using two vms with public ips (internet accessible) for testing purpose.

Everything is working fine INTERNALLY.

I want to expose a service (postgres with port 5432) to the public.

I installed metallb, so that i can use type=LoadBalancer.

The external IP my exposed service became (from metallb) is something like 192.168.240.1. Can i redirect from the master public ip to this internal ip?

Thought of something with ip tables: Redirect from the external IP port 5432 to 192.168.240.1:5432.

Whats the way to go?

I just ordered another ip address which points to my server. How can i use this with metallb?

Would appreciate any help :slight_smile:

Thank you


#2

Metallb allows you to specify a public ip address to use so you can set up the service to a specific address, you can request it by setting spec.LoadBalancerIP, just make sure metallb owns that public IP address.