Kubernetes Service: LoadBalancer

Learn how LoadBalancer Services provision cloud load balancers, what EXTERNAL-IP means, and when they are a better fit than NodePort.

What Is a LoadBalancer Service?

A LoadBalancer Service asks the cloud provider to provision an external load balancer for your application.

It usually builds on top of:

  • a ClusterIP Service
  • a NodePort exposure layer underneath

Full YAML Example

apiVersion: v1
kind: Service
metadata:
  name: web-public
spec:
  selector:
    app: web
  ports:
    - port: 80
      targetPort: 8080
  type: LoadBalancer

Inspect the External Address

kubectl get svc web-public

Look for the EXTERNAL-IP column. In cloud environments, it often appears after the provider provisions the load balancer.

Why It Is Useful

LoadBalancer is convenient when you want straightforward public access without manually wiring infrastructure.

Cost and Trade-offs

TopicConsideration
SimplicityEasy for exposing one service
CostCloud load balancers usually cost money
ScaleFine for a few public services
HTTP routingIngress is often better when many apps share one entry point

LoadBalancer vs Ingress

Use LoadBalancer when you want to expose a service directly.

Use Ingress when you want smarter HTTP routing, such as many hosts or paths through one external entry point.

Think of LoadBalancer as renting a dedicated front gate for one service. Ingress is more like a smart reception desk that routes many visitors to the right rooms.

Exercise

EXTERNAL-IP Meaning

What does the EXTERNAL-IP column usually represent for a LoadBalancer Service?

Exercise

Use vs Ingress

When is Ingress often preferred over many individual LoadBalancer Services?

Continue Learning

Explore Related Topics

Try the Tool

Related Resources