Skip to content

Commit 3222ff8

Browse files
Add blog enhanced-internal-traffic-management-l7-load-balancing-for-kube-apiservers-in-gardener (gardener#662)
1 parent 25a9cd8 commit 3222ff8

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "Enhanced Internal Traffic Management: L7 Load Balancing for kube-apiservers in Gardener"
3+
linkTitle: "Enhanced Internal Traffic Management: L7 Load Balancing for kube-apiservers in Gardener"
4+
newsSubtitle: June 18, 2025
5+
publishdate: 2025-06-18
6+
authors:
7+
- avatar: https://avatars.githubusercontent.com/oliver-goetz
8+
login: oliver-goetz
9+
name: "Oliver G\xF6tz"
10+
aliases: ["/blog/2025/06/18/enhanced-internal-traffic-management-l7-load-balancing-for-kube-apiservers-in-gardener"]
11+
---
12+
13+
Gardener continuously evolves to optimize performance and reliability. A recent improvement focuses on how internal control plane components communicate with `kube-apiserver` instances, introducing cluster-internal Layer 7 (L7) load balancing to ensure better resource distribution and system stability.
14+
15+
### The Challenge: Unbalanced Internal Load on kube-apiservers
16+
17+
Previously, while external access to Gardener-managed `kube-apiserver`s (for Shoots and the Virtual Garden) benefited from L7 load balancing via Istio, internal traffic took a more direct route. Components running within the seed cluster, such as `gardener-resource-manager` and `gardener-controller-manager`, would access the `kube-apiserver`'s internal Kubernetes service directly. This direct access bypassed the L7 load balancing capabilities of the Istio ingress gateway.
18+
19+
This could lead to situations where certain `kube-apiserver` instances might become overloaded, especially if a particular internal client generated a high volume of requests, potentially impacting the stability and performance of the control plane.
20+
21+
### The Solution: Extending L7 Load Balancing Internally
22+
23+
To address this, Gardener now implements cluster-internal L7 load balancing for traffic destined for `kube-apiserver`s from within the control plane. This enhancement ensures that requests from internal components are distributed efficiently across available `kube-apiserver` replicas, mirroring the sophisticated load balancing already in place for external traffic, but crucially, without routing this internal traffic externally.
24+
25+
Key aspects of this solution include:
26+
27+
* **Leveraging Existing Istio Ingress Gateway:** The system utilizes the existing Istio ingress gateway, which already handles L7 load balancing for external traffic.
28+
* **Dedicated Internal Service:** A new, dedicated internal `ClusterIP` service is created for the Istio ingress gateway pods. This service provides an internal entry point for the load balancing.
29+
* **Smart Kubeconfig Adjustments:** The `kubeconfig` files used by internal components (specifically, the generic token kubeconfigs) are configured to point to the `kube-apiserver`'s public, resolvable DNS address.
30+
* **Automated Configuration Injection:** A new admission webhook, integrated into `gardener-resource-manager` and named `pod-kube-apiserver-load-balancing`, plays a crucial role. When control plane pods are created, this webhook automatically injects:
31+
* **Host Aliases:** It adds a host alias to the pod's `/etc/hosts` file. This alias maps the `kube-apiserver`'s public DNS name to the IP address of the new internal `ClusterIP` service for the Istio ingress gateway.
32+
* **Network Policy Labels:** Necessary labels are added to ensure network policies permit this traffic flow.
33+
34+
With this setup, when an internal component attempts to connect to the `kube-apiserver` using its public DNS name, the host alias redirects the traffic to the internal Istio ingress gateway service. The ingress gateway then performs L7 load balancing, distributing the requests across the available `kube-apiserver` instances.
35+
36+
### Benefits
37+
38+
This approach offers several advantages:
39+
* **Improved Resource Distribution:** Load from internal components is now evenly spread across `kube-apiserver` instances, preventing hotspots.
40+
* **Enhanced Reliability:** By avoiding overloading individual `kube-apiserver` pods, the overall stability and reliability of the control plane are improved.
41+
* **Internalized Traffic:** Despite using the `kube-apiserver`'s public DNS name in configurations, traffic remains within the cluster, avoiding potential costs or latency associated with external traffic routing.
42+
43+
This enhancement represents a significant step in refining Gardener's internal traffic management, contributing to more robust and efficiently managed Kubernetes clusters.
44+
45+
### Further Information
46+
47+
To dive deeper into the technical details, you can explore the following resources:
48+
* **Issue:** [gardener/gardener#8810](https://github.com/gardener/gardener/issues/8810)
49+
* **Pull Request:** [gardener/gardener#12260](https://github.com/gardener/gardener/pull/12260)
50+
* **Project Summary:** [Cluster-Internal L7 Load-Balancing Endpoints For kube-apiservers](https://github.com/gardener-community/hackathon/blob/main/2025-06_Schelklingen/README.md#-cluster-internal-l7-load-balancing-endpoints-for-kube-apiservers)
51+
* **Recording Segment:** [Watch the introduction of this feature](https://youtu.be/HguO_KY86ac?t=1490)

0 commit comments

Comments
 (0)