Loading

Quipoin Menu

Learn • Practice • Grow

kubernetes / LoadBalancer Service
tutorial

LoadBalancer Service

When you run Kubernetes on a cloud provider (AWS, GCP, Azure, etc.), you can use the LoadBalancer Service type to automatically provision a cloud load balancer. This gives you a single external IP address to access your application.

What Is LoadBalancer Service?

A LoadBalancer Service builds on NodePort and ClusterIP. It creates an external load balancer in the cloud that forwards traffic to the NodePort on your cluster nodes. The load balancer’s external IP is the entry point.

LoadBalancer integrates with cloud providers to give your Service a public IP address.

LoadBalancer YAML Example

Here’s a Service for Nginx that uses a cloud load balancer:
apiVersion: v1
kind: Service
metadata:
name: nginx-lb
spec:
type: LoadBalancer
selector:
app: nginx
ports:
- port: 80
targetPort: 80
Apply it:
kubectl apply -f nginx-lb.yaml

Obtaining the External IP

It may take a moment for the cloud provider to provision the load balancer. Check status:
kubectl get svc nginx-lb
When the EXTERNAL-IP field shows an IP address (or hostname), you can access your app at http://<external-ip>.

Cost and Use Cases

  • Cloud load balancers incur cost per hour. Suitable for production services that need a stable public IP.
  • For multiple services, each LoadBalancer creates a separate load balancer, which can become expensive. Ingress is a cheaper alternative for HTTP/HTTPS traffic.

LoadBalancer on Minikube

Minikube does not support LoadBalancer directly. However, you can simulate it with minikube tunnel to expose LoadBalancer services locally.


Two Minute Drill
  • LoadBalancer Service automatically provisions a cloud load balancer.
  • Set type: LoadBalancer; the cloud provider assigns an external IP.
  • Ideal for production external access to single services.
  • Each LoadBalancer creates a separate billable resource.

Need more clarification?

Drop us an email at career@quipoinfotech.com