Skip to content

Commit ab3fb48

Browse files
fixup! fixup! fixup! Add KEP 4444: Routing Preference for Services
1 parent dcaa20b commit ab3fb48

File tree

1 file changed

+52
-1
lines changed
  • keps/sig-network/4444-service-routing-preference

1 file changed

+52
-1
lines changed

keps/sig-network/4444-service-routing-preference/README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ the successors of `topologyKeys` and allow implementations to be more flexible.
156156
* **Limitation:** Lacks failover; traffic is dropped if no local endpoint exists.
157157

158158
Note that while the initial proposal of InternalTrafficPolicy proposed a
159-
Local policy, it was dropped later on. This meant that now
159+
`PreferLocal` policy, it was dropped later on. This meant that now
160160
TopologyAwareRouting in conjunction with InternalTrafficPolicy didn’t exactly
161161
allow users to express a much desired use case from topologyKeys which is
162162
"prefer node-local, failover to same zone, then route anywhere" While this
@@ -940,6 +940,57 @@ like `routingPreference` might be a better option is:
940940
preferences as hints, allowing for sophisticated, implementation-specific
941941
algorithms that can evolve over time.
942942

943+
### Reuse Pod Topology Spread Constraints for Traffic Distribution
944+
945+
[Pod Topology Spread
946+
Constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/)
947+
offer a powerful mechanism to influence how Kubernetes schedules pods across
948+
topology domains (like zones, nodes, or regions). Pod Topology Spread
949+
Constraints can be re-used to guide traffic to stay within the same topology
950+
domain as the originating pod.
951+
952+
Challenges:
953+
954+
* **Conflicting Domains:** Services often span multiple pods, which might belong to
955+
different topology domains (e.g., a Service with pods constrained to both
956+
node-level and zone-level Pod Topology Spread Constraints). Resolving routing
957+
conflicts in such scenarios would require complex decision-making.
958+
959+
* **Data Plane Overhead:** Informing data planes like kube-proxy of detailed Topology Spread
960+
Constraints information for each pod could significantly increase the complexity
961+
of communication between the control plane and data plane. This might
962+
necessitate changes to resources like `EndpointSlices` to communicate this extra
963+
information to the data plane (or alternatively, have the data-palne watching
964+
all pods across all nodes, which also tends to be a bad idea.)
965+
966+
The potential benefits of traffic routing based solely on Topology Spread
967+
Constraints might not outweigh the added implementation and configuration
968+
complexity.
969+
970+
A dedicated `routingPreference` fields gets us:
971+
972+
* **Clear Intent:** The `routingPreference` field provides an explicit way for
973+
users to signal desired traffic patterns, focusing solely on traffic
974+
distribution.
975+
976+
* **Implementation Flexibility:** Implementations can intelligently incorporate
977+
TSC information (if desired) alongside other factors like latency, load, or
978+
custom heuristics to optimize routing decisions.
979+
980+
#### Complementary Use of Pod Topology Spread Constraints and routingPreference
981+
982+
Rather than having to choose between the two, Pod Topology Spread Constraints
983+
and `routingPreference` can offer slightly better and resilient traffic
984+
distribution when used in conjunction.
985+
986+
* Users can set `routingPreference` to `Zone` to express the preference for
987+
keeping traffic within the same zone as the client.
988+
* Then, they can configure Pod Topology Spread Constraints to Ensure balanced
989+
pod distribution across zones, maximizing the likelihood that the
990+
`routingPreference` can be satisfied and reduce (although not completely
991+
eliminate) chances of overload for a single zone.
992+
993+
943994
## Infrastructure Needed (Optional)
944995

945996
N/A

0 commit comments

Comments
 (0)