Kubernetes YAML Networking/LoadBalancer Service YAML

Request external load balancing from the platform.

Section: Services

LoadBalancer Service YAML

yaml
yaml
apiVersion: v1
kind: Service
metadata:
  name: api-lb
spec:
  selector:
    app: api
  ports:
    - port: 80
      targetPort: 8080
  type: LoadBalancer

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Services
ClusterIP Service YAML
Expose Pods internally in the cluster.
OpenIn sheetyamlsame section
NodePort Service YAML
Expose the service on each node's IP.
OpenIn sheetyamlsame section
Headless Service YAML
Expose individual Pod DNS records for stateful apps.
OpenIn sheetyamlsame section
Basic Ingress YAML
Route traffic by host and path.
Default deny ingress policy
Block incoming traffic until explicitly allowed.
Enable TLS on Ingress
Terminate HTTPS with a Secret-backed certificate.