Topology Overview
KubeLB supports three deployment topologies for Envoy proxy:Shared
One Envoy proxy per tenant cluster (Default)
Global
One Envoy proxy for all tenant clusters (Deprecated)
Dedicated
One Envoy proxy per service (Deprecated)
Current Status: The
shared topology is the only supported topology. The dedicated and global topologies are deprecated and will be removed in a future release. Both deprecated topologies now default to shared topology.Shared Topology (Default)
In shared topology, a single Envoy proxy deployment is created for each tenant cluster. All services and routes from that tenant are configured to use this shared Envoy proxy.Architecture
Benefits
Resource Efficiency
Resource Efficiency
Significantly reduces resource consumption compared to dedicated topology. A single Envoy instance handles all traffic for a tenant.
Tenant Isolation
Tenant Isolation
Each tenant has its own Envoy proxy, providing fault isolation. Issues in one tenant’s traffic don’t affect others.
Simplified Management
Simplified Management
Fewer Envoy instances to monitor and maintain compared to dedicated topology.
Scalability
Scalability
Easy to scale per tenant by adjusting replica count or using DaemonSet mode.
Configuration
Deployment Modes
- Deployment (Default)
- DaemonSet
Envoy runs as a Kubernetes Deployment with a configurable number of replicas.Use Cases:
- Clusters with specific capacity requirements
- Fine-grained control over replica count
- Clusters where not all nodes need Envoy
Pod Distribution
Control how Envoy pods are distributed across nodes:When
singlePodPerNode: true, KubeLB adds pod anti-affinity rules to prevent multiple Envoy pods on the same node.Global Topology (Deprecated)
In global topology, a single Envoy proxy deployment is shared across all tenant clusters.Architecture
Why It’s Deprecated
- No Fault Isolation: Issues in one tenant affect all tenants
- Scaling Challenges: Hard to scale for specific tenant needs
- Resource Contention: All tenants compete for the same Envoy resources
- Configuration Complexity: Large xDS snapshots with all tenant configurations
Dedicated Topology (Deprecated)
In dedicated topology, a separate Envoy proxy deployment was created for each LoadBalancer service.Architecture
Why It Was Deprecated
- Resource Intensive: Hundreds of Envoy instances for many services
- Operational Overhead: Too many deployments to monitor and maintain
- Cost: High resource consumption in the management cluster
- Complexity: Difficult to manage at scale
Envoy xDS Configuration
Regardless of topology, KubeLB uses the Envoy xDS (Discovery Service) protocol to dynamically configure Envoy proxies.xDS Server
The KubeLB Manager hosts an xDS control plane server:- Listens on port 18000 (default)
- Implements Envoy’s gRPC-based xDS APIs
- Maintains a snapshot cache of configurations
- Pushes updates to connected Envoy proxies
Configuration Resources
KubeLB configures three main xDS resource types:- Listeners
- Clusters
- Endpoints
Define ports that Envoy listens on:
- TCP Listener: For Layer 4 TCP services
- UDP Listener: For Layer 4 UDP services
- HTTP Listener: For Layer 7 HTTP/HTTPS traffic
Bootstrap Configuration
Each Envoy proxy starts with a bootstrap configuration that:- xDS Cluster: Connects to KubeLB Manager’s xDS server
- Admin Listener: Local admin interface (127.0.0.1:9001)
- Stats Listener: Prometheus metrics endpoint (port 19001)
- Readiness Probe: Health endpoint (port 19003)
Dynamic Updates
When services change:- CCM detects change in tenant cluster
- CCM updates LoadBalancer/Route CRD in management cluster
- KubeLB Manager controller reconciles the change
- Manager generates new xDS snapshot
- xDS server pushes update to connected Envoy proxies
- Envoy applies the configuration without restart
High Availability
For production deployments, ensure high availability:Multiple Replicas
Pod Disruption Budget
KubeLB automatically creates a PodDisruptionBudget for Envoy deployments:Graceful Shutdown
Configure graceful shutdown to drain connections before termination:- Pod receives TERM signal
- Shutdown manager starts draining Envoy
- Envoy stops accepting new connections
- Existing connections are allowed to complete
- After
drainTimeoutor when connections reach zero, Envoy exits
Overload Manager
Protect Envoy from resource exhaustion:- 95% heap: Start shrinking heap by freeing memory
- 98% heap: Stop accepting new requests
- Max connections: Reject new connections
Monitoring and Observability
Metrics
Envoy exposes Prometheus metrics on port 19001:envoy_cluster_upstream_cx_active: Active connections to upstreamsenvoy_cluster_membership_healthy: Healthy endpoints per clusterenvoy_listener_downstream_cx_total: Total downstream connectionsenvoy_server_memory_allocated: Memory usage
Health Checks
Envoy provides multiple health endpoints:- Readiness:
http://envoy:19003/ready- Ready to accept traffic - Liveness:
http://envoy:19004/healthz- Envoy process is alive - Admin:
http://127.0.0.1:9001/- Admin interface (localhost only)
Access Logs
Envoy logs all requests to stdout:- Timestamp
- Request method and path
- Response code
- Bytes sent/received
- Duration
- Client IP
- Upstream host
Troubleshooting
Envoy Pod Not Starting
Envoy Pod Not Starting
Check:
- Bootstrap configuration is valid
- xDS server is reachable from the pod
- Resource requests/limits are not too restrictive
- Node selectors and tolerations are correctly configured
No xDS Configuration Updates
No xDS Configuration Updates
Verify:
- Envoy is connected to xDS server (check logs)
- LoadBalancer/Route CRDs exist in management cluster
- KubeLB Manager controller is running
- No errors in manager logs
High Memory Usage
High Memory Usage
Configure overload manager:Or increase resource limits:
Best Practices
Use Shared Topology
Always use shared topology for the best balance of resource efficiency and isolation.
Enable Graceful Shutdown
Configure graceful shutdown to prevent connection drops during rolling updates.
Next Steps
Configuration Reference
Complete Config CRD reference
Load Balancing
Understand Layer 4 and Layer 7 load balancing
Monitoring
Set up monitoring and metrics
Performance Tuning
Optimize KubeLB performance
