-
Overview
- Google Cloud Internal HTTP(S) Load Balancing is a proxy-based, regional Layer 7 load balancer that enables users to run and scale services behind an internal load balancing IP address
- Internal HTTP(S) Load Balancing distributes HTTP and HTTPS traffic to backends hosted on Compute Engine and Google Kubernetes Engine (GKE)
- The load balancer is accessible only in the chosen region of the Virtual Private Cloud (VPC) network on an internal IP address
- Internal HTTP(S) Load Balancing is a managed service based on the open source Envoy proxy
- It enables rich traffic control capabilities based on HTTP(S) parameters
- After the load balancer has been configured, it automatically allocates Envoy proxies to meet traffic needs
- At a high level, an internal HTTP(S) load balancer consists of an internal IP address to which clients send traffic.
- Only clients that are located in the same region as the load balancer can access this IP address
- Internal client requests stay internal to the network and region.
- There can be one or more backend services to which the load balancer forwards traffic.
- Backends can be Compute Engine VMs, groups of Compute Engine VMs (through instance groups), or GKE nodes (through network endpoint groups [NEGs])
- These backends must be located in the same region as the load balancer
- A URL map, which defines traffic control rules (based on Layer 7 parameters such as HTTP headers) that map to specific backend services
- The load balancer evaluates incoming requests against the URL map to route traffic to backend services or perform additional actions (such as redirects)
- Health checks, which periodically check the status of backends and reduce the risk that client traffic is sent to a non-responsive backend
-
Path-based routing
- One common use case is load balancing traffic among services
- An internal client can request video and image content by using the same base URL, mygcpservice.internal, with the paths /video and /images
- The internal HTTP(S) load balancer's URL map specifies that requests to path /video should be sent to the video backend service, while requests to path /images should be sent to the images backend service
- When an internal client sends a request to the load balancer's internal IP address, the load balancer evaluates the request according to this logic and sends the request to the correct backend service
-
Modernizing legacy services
- Internal HTTP(S) Load Balancing can be an effective tool for modernizing legacy applications
- Deploy an internal HTTP(S) load balancer in front of a legacy application
- Use the load balancer's traffic control capabilities to direct a subset of traffic to new microservices that replace the functionality that the legacy application provides
- Configure the load balancer's URL map to route all traffic to the legacy application by default
- This maintains the existing behavior as replacement services are developed, update the URL map to route portions of traffic to these replacement services
-
Three-tier web services
- Use Internal HTTP(S) Load Balancing to support traditional three-tier web services
- At each tier, the load balancer type depends on traffic type
- Web tier: Traffic enters from the internet and is load balanced by using an external HTTP(S) load balancer
- Application tier: The application tier is scaled by using a regional internal HTTP(S) load balancer
- Database tier: The database tier is scaled by using an internal TCP/UDP load balancer
-
Architecture and resources
- An internal managed forwarding rule specifies an internal IP address, port, and regional target HTTP(S) proxy.
- Clients use the IP address and port to connect to the load balancer's Envoy proxies
- A regional target HTTP(S) proxy receives a request from the client
- The HTTP(S) proxy evaluates the request by using the URL map to make traffic routing decisions
- The proxy can also authenticate communications by using SSL certificates
- If using Internal HTTP(S) Load Balancing, the HTTP(S) proxy uses regional SSL certificates to prove its identity to clients
- A target HTTP(S) proxy supports up to a number of SSL certificates
- The HTTP(S) proxy uses a regional URL map to make a routing determination based on HTTP attributes (such as the request path, cookies, or headers)
- Based on the routing decision, the proxy forwards client requests to specific regional backend services
- The URL map can specify additional actions to take such as rewriting headers, sending redirects to clients, and configuring timeout policies (among others)
- A regional backend service distributes requests to healthy backends (either instance groups containing Compute Engine VMs or NEGs containing GKE containers)
- One or more backends must be connected to the backend service.
- Backends can be instance groups or NEGs in a managed instance groups (zonal or regional), unmanaged instance groups (zonal) or network endpoint groups (zonal)
- Instance groups and NEGs cannot be used on the same backend service
- A regional health check periodically monitors the readiness of backends
- This reduces the risk that requests might be sent to backends that can't service the request
- A proxy-only subnet whose IP addresses are the source of traffic from the load balancer proxies to your backends is required
- Create one proxy-only subnet in each region of a VPC network which uses internal HTTP(S) load balancers
- Google manages this subnet, and all internal HTTP(S) load balancers in the region share it
- This subnet cannot be used to host backends
- A firewall is required for backends to accept connections from the proxy-only subnet.
-
Traffic types, scheme, and scope
- Backend services support the HTTP, HTTPS, or HTTP/2 protocols
- Clients and backends do not need to use the same request protocol
- For example, clients can send requests to the load balancer by using HTTP/2, and the load balancer can forward these requests to backends by using HTTP/1.1
- Because the scope of an internal HTTP(S) load balancer is regional, not global, clients and backend VMs or endpoints must all be in the same region
-
Limitations
- Internal HTTP(S) Load Balancing operates at a regional level
- There's no guarantee that a request from a client in one zone of the region is sent to a backend that's in the same zone as the client
- Session affinity doesn't reduce communication between zones
- An internal HTTP(S) load balancer supports HTTP/2 only over TLS
- Google Cloud doesn't warn if the proxy-only subnet runs out of IP addresses
- Within each VPC network, each internal managed forwarding rule must have its own IP address
- The internal forwarding rule that internal HTTP(S) load balancer uses must have exactly one port
- The WebSocket protocol is not supported
-
Incompatible features
- Identity-Aware Proxy
- Cloud CDN
- Google Cloud Armor
- Cloud Storage buckets
- Google-managed SSL certificates
- SSL policies
- VPC Network Peering
-
Shared VPC host project
- Client VMs can be located in either the host project or any connected service project
- The client VMs must use the same Shared VPC network and the same region as the load balancer
- All the load balancer's components and backends must be in the host project
- This is different from other Google Cloud load balancers because none of the internal HTTP(S) load balancer components can be in a service project when the load balancer uses a Shared VPC network
- The host project within the Shared VPC network owns and creates the proxy-only subnet (purpose=INTERNAL_HTTPS_LOAD_BALANCER)