πŸ“šBook Signing at KubeCon EU 2026Meet us at Booking.com HQ (Mon 18:30-21:00) & vCluster booth #521 (Tue 24 Mar, 12:30-1:30pm) β€” free book giveaway!RSVP Booking.com Event
Networking intermediate ⏱ 15 minutes K8s 1.28+

Kubernetes LoadBalancer Service Guide

Expose Kubernetes services with LoadBalancer type for production traffic. Covers cloud providers, MetalLB for bare-metal, health checks, and cost optimization.

By Luca Berton β€’ β€’ πŸ“– 5 min read

πŸ’‘ Quick Answer: networking

The Problem

This is one of the most searched Kubernetes topics with thousands of monthly searches. A comprehensive, production-ready guide prevents hours of trial and error.

The Solution

Create LoadBalancer Service

apiVersion: v1
kind: Service
metadata:
  name: web-lb
  annotations:
    # AWS-specific
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
    service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
    # GKE-specific
    # cloud.google.com/neg: '{"ingress": true}'
spec:
  type: LoadBalancer
  selector:
    app: web
  ports:
    - port: 80
      targetPort: 8080
    - port: 443
      targetPort: 8443
# Check external IP
kubectl get svc web-lb
# NAME     TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)
# web-lb   LoadBalancer   10.96.10.50    203.0.113.100    80:31234/TCP,443:31235/TCP

# Access
curl http://203.0.113.100

MetalLB for Bare-Metal

helm repo add metallb https://metallb.universe.tf
helm install metallb metallb/metallb --namespace metallb-system --create-namespace
# IP address pool
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: production
  namespace: metallb-system
spec:
  addresses:
    - 192.168.1.200-192.168.1.250
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: default
  namespace: metallb-system
spec:
  ipAddressPools: [production]

Internal Load Balancer

metadata:
  annotations:
    # AWS: internal NLB
    service.beta.kubernetes.io/aws-load-balancer-scheme: internal
    # GKE: internal LB
    networking.gke.io/load-balancer-type: Internal
    # Azure: internal LB
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"

Cost Tip

# Each LoadBalancer creates a cloud LB ($15-20/mo each!)
# Use ONE Ingress Controller with LoadBalancer β†’ route to many services
# Instead of:
#   Service A β†’ LoadBalancer ($20/mo)
#   Service B β†’ LoadBalancer ($20/mo)
#   Service C β†’ LoadBalancer ($20/mo)
# Use:
#   Ingress Controller β†’ 1 LoadBalancer ($20/mo) β†’ routes to A, B, C
graph TD
    A[Internet] --> B[Cloud Load Balancer]
    B --> C[Node 1: kube-proxy]
    B --> D[Node 2: kube-proxy]
    C --> E[Pod]
    D --> E
    F[Bare metal] --> G[MetalLB: ARP/BGP]
    G --> H[Assigns IP from pool]
    H --> I[Routes to pods]

Frequently Asked Questions

LoadBalancer stuck on Pending EXTERNAL-IP?

On cloud: check IAM permissions for LB creation. On bare-metal: you need MetalLB or similar β€” Kubernetes can’t create LBs without a provider.

One LoadBalancer per service?

Yes β€” each Service of type LoadBalancer gets its own cloud LB. This gets expensive. Use Ingress to multiplex many services behind one LB.

Best Practices

  • Start with the simplest configuration that solves your problem
  • Test in staging before production
  • Use kubectl describe and events for troubleshooting
  • Document team conventions for consistency

Key Takeaways

  • This is fundamental Kubernetes operational knowledge
  • Follow established conventions and recommended labels
  • Monitor and iterate based on real production behavior
  • Automate repetitive tasks to reduce human error
#loadbalancer #service #external-access #metallb #cloud
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Kubernetes Recipes book cover

Want More Kubernetes Recipes?

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens