Kubernetes L4 LoadBalancing with MetalLBFeb 9, 2022 2 min readKubernetes L4 Load Balancing with MetalLB Although bare-metal installations of Kubernetes can support both L4 and L7 load-balancing, it comes without any pre-installed load-balancing support, especially on the L4 load balancing side, and expects for the administrator to bring his/her own desired choice.I wanted to have this post dedicated to L4 load-balancing and how to provide it via MetalLB, but just for the sake to preserve the integrity of the topic, I want to give you a quick recap for service types in Kubernetes.How to expose your services on your bare-metal Kubernetes; A quick guide Kubernetes on public clouds are easy :). I dont wanna be mean, that is not the point. But there are some things that we take it for granted in public clouds when we run Kubernetes, such as LoadBalancer service type.In a nutshell, we expose things running in Kubernetes via Services and a service definition in Kubernetes is simple as this yaml file;apiVersion: v1 kind: Service metadata: name: my-service spec: type: LoadBalancer # this is important! selector: app: MyApp ports: - protocol: TCP port: 80 targetPort: 9376 and this will give us an IP address from our cloud provider, which we can directly hit and access our service, a website maybe. Pretty cool, isnt it?Source: https://kubernetes.github.io/ingress-nginx/deploy/baremetal/The bad news is, we dont have this on bare-metal Kubernetes clusters :). At least, not by default. So there are some things that we need to consider, if we want to expose our services, expecially if we are running our services in a bare-metal Kubernetes cluster.Source: https://kubernetes.github.io/ingress-nginx/deploy/baremetal/L7 usually handled via an Ingress Controller and the Nginx Ingress controller (maybe along with Trafeak) is one of the most used ingress controllers and most of the current bare-metal Kubernetes distributions (such as Rancher, Openshift, etc.) comes with a pre-installed Nginx Ingress controller.What about L4 Load Balacer?