Skip to content

feat(hubble): Add trafficDistribution field support for Kubernetes 1.31+ #1686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

younsl
Copy link
Contributor

@younsl younsl commented Jun 16, 2025

Description

Add trafficDistribution field support to Hubble services (excluding DaemonSet-connected services) with Kubernetes version compatibility check (≥1.31). This provides better performance and reliability than annotation-based topologyAwareRouting by being natively integrated into the Service API.

Changes:

  • Added trafficDistribution configuration to Hubble Relay and UI services in values.yaml
  • Updated service templates with conditional rendering based on Kubernetes version
  • Excluded DaemonSet-connected services (agent, peer) as they use hostNetwork

Usage

Retina administrators can now set hubble.relay.service.trafficDistribution: PreferClose or hubble.ui.service.trafficDistribution: PreferClose in their values to enable topology-aware routing with improved performance characteristics.

Related Issue

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • [ x I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Please add any relevant screenshots or GIFs to showcase the changes made.

Additional Notes

Why trafficDistribution over topologyAwareRouting?

The trafficDistribution field is recommended over topologyAwareRouting annotations as it provides native Kubernetes Service API integration with better performance and reliability characteristics. This field is available in Kubernetes 1.31+ and offers more granular control over traffic routing behavior compared to the annotation-based approach.

---
title: topologyAwareRouting vs trafficDistribution
---
graph LR
    A[K8s < 1.31] --> B["`**topologyAwareRouting**
    Annotation (Legacy)`"]
    C[K8s ≥ 1.31] --> D["`**trafficDistribution**
    PreferClose`"]
    
    B --Migration--> D 
    B --> F["`Inter AZ DTO Cost
    Reduction`"]
    D --> F

    style D fill:darkorange, color:white
    style B stroke:red, color:white

    note["As of Kubernetes 1.31, the trafficDistribution feature has been moved to beta."]

    style note fill:transparent, stroke:transparent, color:lightgray
Loading

Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

younsl added 2 commits June 17, 2025 03:00
* Add spec.trafficDistribution field to service resources excluding
daemonset services.

* Reference: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-distribution
* Background commit for helm template: fd3ba1d
@younsl younsl requested a review from a team as a code owner June 16, 2025 18:21
@younsl younsl requested review from rbtr and agrawaliti June 16, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant