liveBook · Manning

Loadbalancer service

As explained in Machine Learning Platform Engineering

A LoadBalancer service is a Kubernetes service that provisions or uses an external load balancer to expose selected pods to external clients.

A LoadBalancer service exposes selected Kubernetes pods to external clients through an external load balancer. It preserves stable access while pods are restarted, deleted, or rescheduled. section 3.3.4

Configure the service with:

  • apiVersion: v1, kind: Service, and type: LoadBalancer. section 3.3.4
  • A port exposed by the service and a targetPort where the application listens on selected pods. section 3.3.4
  • A selector matching the application labels, such as app: fast-api. section 3.3.4

Expose an application externally

Apply a manifest with type: LoadBalancer, port: 80, targetPort: 8083, and selector app: fast-api using kubectl create -f loadbalancer-service.yaml. Check kubectl get service for the assigned EXTERNAL-IP, then send requests such as curl http://34.101.34.188:80. section 3.3.4

Figure 3.6 The user interacts with service 1 to access the frontend application. The frontend application talks to the backend application via service 2. Services here act as an abstraction.
A close-up of a green rectangular with black text

AI-generated content may be incorrect.

Use the service-abstraction diagram to trace external traffic through the load balancer to application pods. section 3.3.4

How Machine Learning Platform Engineering covers it

How deep it goes
Demonstrates manifest fields, creation, assigned external IPs, and requests, while deferring provider-specific configuration details.
Examples
Uses a FastAPI joke service, a LoadBalancer manifest, kubectl create, kubectl get service, and curl.
What it assumes
Assumes basic Kubernetes objects, pods, labels, ports, services, and kubectl usage.
What you can do after
Operate external access by applying a manifest, retrieving the assigned external IP, and issuing HTTP requests.
How it connects
Connects Kubernetes Services with pods, selectors, ports, ClusterIP, NodePort, and external load balancers.

Also explained in

Compare how 5 books explain loadbalancer service →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Platform Engineering. The section links point to the parts of the book it draws on.