A Kubernetes LoadBalancer service routes external traffic to your pods through a cloud provider's network load balancer. When you run:
kubectl expose deployment my-app --type=LoadBalancer --name=my-service
you create a service that gets a public IP and directs traffic to the pods in the deployment. The type=LoadBalancer flag tells Kubernetes to request this resource from the cluster’s cloud integration—AWS ELB, GCP TCP/HTTP, Azure Load Balancer, or another supported provider.
You can check the status with:
kubectl get services
Look at the EXTERNAL-IP column. Pending means the cloud provider hasn’t finished provisioning. Once you have an IP or hostname, you can connect directly from outside the cluster.
Scaling services with a LoadBalancer is straightforward. The load balancer automatically distributes traffic to healthy pods. Scale with: