This page provides a general overview of how Google Kubernetes Engine (GKE) creates
and manages Cloud Load Balancing. This page assumes that you know about
the following:

- Types of [Google Cloud load balancers](https://docs.cloud.google.com/load-balancing/docs/load-balancing-overview.md.txt#load-balancer-types)
- The difference between Layer 4 (Network Load Balancers) and Layer 7 (Application Load Balancers) load balancers

This page is for Cloud architects and Networking specialists who
design and architect the network for their organization. To learn more about
common roles and example tasks that we reference in Google Cloud content, see
[Common GKE Enterprise user roles and tasks](https://docs.cloud.google.com/kubernetes-engine/enterprise/docs/concepts/roles-tasks.md.txt).

## How GKE creates load balancers

To make your applications accessible either from outside the cluster (external
users) or within your private network (internal users), you can expose your
applications by provisioning load balancers using the Gateway, Ingress, and
Service APIs. Alternatively, you can create the load balancer components
yourself, while GKE manages the network endpoint groups (NEGS)
that connect your load balancer to the Pods in your cluster.

### Gateway

The GKE Gateway controller is Google's implementation of the Kubernetes
Gateway API for Cloud Load Balancing. Gateway API is an open-source project
aimed at standardizing how service meshes and ingress controllers expose
applications in Kubernetes. Gateway API is designed to be a more expressive, flexible, and
extensible successor to the Ingress resource.

The GKE Gateway controller is used to configure Layer 7
Application Load Balancers to expose HTTP(S) traffic, and Layer 4
proxy Network Load Balancers (TCP proxy load balancers) with TLS passthrough and
SNI-based routing to expose end-to-end encrypted TLS traffic to applications
that run in the cluster.
**Best practice** :

Use Gateway API to implement your load balancer.

### Ingress

The GKE Ingress controller is Google's implementation of the
Ingress API. The Ingress API lets you manage external access to Services that run
in a cluster. When you create an Ingress resource in GKE, the
controller automatically configures a Layer 7 Application Load Balancer that
allows HTTP or HTTP(S) traffic to reach your applications that run in the
cluster.

GKE Gateway is the recommended choice for new deployments and
applications that require advanced traffic management, multi-protocol support,
or better multi-tenancy. However, GKE Ingress is a viable option
for simpler HTTP/HTTPS routing scenarios, especially for existing configurations
where the benefits of migrating to the Gateway API might not yet outweigh the
effort.

### LoadBalancer Services

The [Service API](https://kubernetes.io/docs/concepts/services-networking/service/) lets you
expose applications that run as Pods in your cluster to external or internal
traffic. When you create a Service of type `LoadBalancer`, GKE
automatically creates a Layer 4 (TCP/UDP)
Passthrough Network Load Balancer based on the parameters of your Service manifest.

In Passthrough Network Load Balancers, when traffic reaches your backend VMs, the original
source and destination IP addresses, the communication protocol (like TCP or
UDP), and the port numbers (if the protocol uses them) remain the same. This
means that traffic is directly passed through to the backend VMs or Pods and
the load balancer does not terminate the connections. The backend services
handle the termination of connections and ensure that traffic flows seamlessly
from the client to the Service.

#### Weighted load balancing

If you configured an external LoadBalancer Service that clients
outside your VPC network and Google Cloud VMs can access,
then you can enable [weighted load balancing](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/service-load-balancer.md.txt#weighted-lb).
Weighted load balancing distributes traffic based on the number of serving Pods
on each GKE node so that nodes that have more serving Pods
receive a larger proportion of traffic compared to nodes that have fewer Pods.

### Standalone NEGs

Another method to manage your load balancers in GKE is to create
the load balancer components yourself, and let GKE manage the
NEGs. This type of load balancer is called a proxy Network Load Balancer. NEGs are a
way to represent groups of backend endpoints (for example, Pods) for load
balancing.

This type of load balancer is intended for TCP traffic only.
proxy Network Load Balancers distribute TCP traffic to backends in your
VPC network or in other cloud environments. Traffic is terminated
at the load balancing layer. The load balancer then forwards the traffic by
establishing new TCP connections to the closest available backend.

## What is container-native load balancing?

Container-native load balancing is the practice of evenly distributing traffic
directly to the IP addresses of individual Pods (rather than nodes) using the
`GCE_VM_IP_PORT` NEGs. `GCE_VM_IP_PORT` NEGs allow you
to specify backend endpoints using either the primary internal IP address of a
Compute Engine virtual machine (VM), or an IP address from one of
the VM's configured alias IP ranges.

Container-native load balancing is used for all GKE-managed Layer
7 load balancers, including Gateway and Ingress, and standalone NEGs.
LoadBalancer Services don't use container-native load balancing. However, you can
achieve a similar capability by enabling weighted load balancing.

Container-native load balancing has several advantages, including improved
network performance and improved health checks, because it targets Pods directly.
For more information, see [Container-native load
balancing](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/container-native-load-balancing).

> [!NOTE]
> **Note:** To determine which load balancer best meets your needs, see [Choose a load
> balancer](https://docs.cloud.google.com/load-balancing/docs/choosing-load-balancer).

## Summary tables

Use the following tables to help you plan your load balancing configuration.

### Choose a type of load balancer

The following table shows you what type of load balancer is created for a given
resource (Gateway, Ingress, or LoadBalancer Service):

| Kubernetes resource | Type of load balancer created |||
| Kubernetes resource | Application Load Balancer | Proxy Network Load Balancer | Passthrough Network Load Balancer |
|---|---|---|---|
| Gateway | Yes | Yes | N/A |
| Ingress | Yes | N/A | N/A |
| LoadBalancer Service | N/A | N/A | Yes |

### Choose a method for creating a load balancer

The following table shows you the options in GKE to create your chosen load balancer:

| Load balancer type | Methods to create the chosen load balancer ||||
| Load balancer type | Gateway | Ingress | LoadBalancer Service | Standalone NEGs |
|---|---|---|---|---|
| [Global external Application Load Balancer](https://docs.cloud.google.com/load-balancing/docs/https.md.txt) | Yes | N/A | N/A | Yes |
| [Classic external Application Load Balancer](https://docs.cloud.google.com/load-balancing/docs/https.md.txt) | Yes | Yes | N/A | Yes |
| [Regional external Application Load Balancer](https://docs.cloud.google.com/load-balancing/docs/https.md.txt) | Yes | N/A | N/A | Yes |
| [Regional internal Application Load Balancer](https://docs.cloud.google.com/load-balancing/docs/l7-internal.md.txt) | Yes | Yes | N/A | Yes |
| [Cross-region internal Application Load Balancer](https://docs.cloud.google.com/load-balancing/docs/l7-internal.md.txt) | Yes | N/A | N/A | Yes |
| [Proxy Network Load Balancer](https://docs.cloud.google.com/load-balancing/docs/proxy-network-load-balancer.md.txt) (all types)^1^ | Yes | N/A | N/A | Yes |
| [Passthrough Network Load Balancer](https://docs.cloud.google.com/load-balancing/docs/passthrough-network-load-balancer.md.txt) (internal and external) | N/A | N/A | Yes | N/A |

^1^ Gateway API supports proxy Network Load Balancers configured for TLS
passthrough with SNI-based routing by using TLSRoute resources on supported
GatewayClasses.

## What's next

- Learn about the [Gateway API in GKE](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/gateway-api.md.txt).
- Learn how to [Deploy a TLS passthrough Gateway](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/deploy-tls-passthrough-gateway.md.txt).
- Learn about [GKE Ingress](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/ingress.md.txt).
- Learn about [LoadBalancer Services](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/service-load-balancer.md.txt).