-
Load Balancing
-
Overview
- Distributes network traffic to backend instances
- Single frontend point of access
- Multiple backend targets to serve traffic
- Software defined, not physical
- Global or regional scope depending on type
- Backend traffic subject to firewall rules
-
Types
-
Global
- HTTP(s) Layer 7
- SSL Proxy
- TCP Proxy
-
Regional
- Network Load Balancer
- Internal Load Balancer
- Internal HTTP(S) Load Balancer
-
External
-
HTTP(s) Layer 7
- Ports 80/443
-
SSL Proxy
- TCP with SSL Offload
- Set of preset ports
-
TCP Proxy
- TCP with no SSL offload
- Set of preset ports
-
Network Load Balancer
- TCP with no SSL offload
- Any ports
-
Internal
- Internal HTTP(S) Load Balancer
- Internal Load Balancer
- Any ports
-
Proxied
- Terminates incoming traffic at Load Balancer
- Creates a new connection to backend
- All Global Load Balancers
-
Non-Proxied
- Traffic goes though the load balancer (pass-through) and forwarded on to the VM
- All regional-only load balancers (Network, Internal)
- Does not support IPv6
- Preserves client IP
-
HTTP(S)
- Global, Layer 7
- Ports 80, 8080, 443
- IPv4, IPv6 (terminated by Load Balancer at edge POP)
- QUIC protocol support
- Native support for websockets protocol
- With Session Affinity, client IP routes traffic from client to the same backend instance
-
Forwarding Rules
- Fowards traffic to backend by matching location and URL Map
- Location is closest regional backend to user request
- URL Map address maps a backend to send traffic to
-
SSL Proxy
- Encrypted non-HTTP traffic
- Global scope
- Terminates traffic at Load Balancer
- Managed SSL certificates
- Automatic patching to fix vulnerabilities
- Traffic between load balancer and backend is SSL or TCP
-
TCP Proxy
- Unencrypted non-HTTP traffic
- Global scope
- Terminates traffic at Load Balancer
- Automatic patching to fix vulnerabilities
- Supports many but not all TCP ports
-
Network
- Regional/external
- TCP/UDP traffic (Layer 4 of OSI model)
- Balance requests by IP protocol data (IP, port, protocol type)
- Forwarding rules matched by IP, protocol, port range
- Backend can be a target pool or an instance group
-
Internal
- Regional/internal
- Private load balancer within the same VPC
- Operates over Internal IP addresses
- Same option as Network load balancer but for internal only traffic
- Often used by applications with multiple tiers
-
DNS
-
Cloud DNS
- Managed DNS host
- Translates domain names into IP
- A record maps host names to IPv4 address
- Name server (NS) record delegates DNS queries to an authoritative server
- Both public (external) and private (internal) hosting
- Not a registrar but an authoritative DNS record host
- Requires pointing registrar name servers to Cloud DNS
- Only GCP service with 100% SLA
- Automatic scaling
- Creates millions of DNS records
-
Managed Zones
-
Public Zone
- Queried over the public Internet
- Public website (A record), email routing (MX records)
-
Private Zone
- Not visible or queried over the public Internet
-
Implementation
- Hosted in GCP project
- Create one or more managed zones for DNS records
- Container for DNS records for domain
- Each domain has its own managed zone
- Can optionally include delegated subzones
- Subdomain requests forwarded to separate set of name server records
-
DNSSEC
- Authenticates responses to domain name lookups
- Protects domains from spoofing and cache poisoning attacks
- Provides strong authentication (but not encryption) of domain lookups
- Both registrar and registry must support DNSSEC for the TLD in use
- Prevents spoofing or responses to requests
- Provides strong authentication of lookups
-
Operations
- First enable DNSSEC in Cloud DNS
- Then enable DNS at registrar
- Add DS record to registrat at top level domain TLD
- Not all registrars support DNSSEC
- Disabling DNSSEC
- Order is critically important
- First disable DNSSEC at domain registrar
- Ensure DNSSEC resolvers can still resolve names in Cloud DNS zone
- After DS records expire in registrar cache, turn off DNSSEC in Cloud DNS
-
Tips
- Proper DNSSEC TTL settings prevent resolution errors
- Too long and too short can cause problems
- Avoid TLSs longer than 3 days