-
Notifications
You must be signed in to change notification settings - Fork 203
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
Implement traffic distribution for reability, latency and cost in kubernetes cloud provider #675
Comments
Hello again, Thanks to @juampa, we've implemented a POC in version 2.10.16 of the controller, which is the one we're currently using. Since in the EKS Kubernetes clusters we are using the VPC-CNI add-on, where the pod IPs come from the subnet ranges, we can associate IP - subnet - zone and put the pods that don't belong to the controller's zone in backup. For this, we have implemented two new environment variables. This works; however, in this version, when the service is created from scratch, the backup status doesn't appear correctly in the stats, although it shows up correctly in the haproxy.cfg. We think it could be a bug or that we are not making the changes in the correct places. You can see the code here: We have tested other approaches by extracting real-time data from the node and the service. We look forward to your feedback. Thank you. |
Hi @MLR96 , Thanks for your contribution. with
In the stats, the line for the backup SRV is blue with Can you give me more information on what's incorrect for you in the stats ? |
Hi @hdurand0710, When the replicas of a deployment are scaled up and more srv are generated, the "backup" label is correctly set in the haproxy.cfg file, but both appear as "UP" in the runtime. Once a reload of HAProxy is performed, the configuration loads correctly in the runtime. We believe this might be an error when registering the srv in the runtime, or that our code is incorrect. Thank you. |
@MLR96 |
@hdurand0710 |
Hi @hdurand0710 I was reviewing the runtime update and I was able to make everything work correctly. It seems that the runtime update and the haproxy.cfg file update happen in different places. I’m still not entirely sure, but after adding the following commit, everything works as it should in the poc. Best regards. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
PING |
hi @mlophez I've labeled it as enhancement and will check with HAProxy team if that can be added to runtime |
Hi @oktalz, Thanks for your reply. At this moment the patch we made works for our use case. We remain available and willing to collaborate on a solution that works for everyone. Best regards |
In cloud-based Kubernetes environments, it is common to have multiple availability zones within the same cluster.
Starting from Kubernetes 1.31, kube-proxy implements a type of load balancing that prioritizes keeping traffic within the same availability zone. This ensures better latencies and significant cost savings, as traffic crossing availability zones can be expensive.
https://kubernetes.io/docs/concepts/services-networking/service/#traffic-distribution
Since the HAProxy Ingress Controller doesn't use Kubernetes services but directly updates the backends with the pod IPs, I have the following question:
Would it be possible to have an option for HAProxy to route traffic only to the pods within the same availability zone?
This could be achieved by detecting the availability zone where the controller is running at startup, and then registering the SRVs from the same AZ as normal and the others as backups.
What do you think?
This would allow us to save considerable costs and improve latencies.
In our specific case, we use HAProxy both for traffic coming from the internet and for traffic between services.
I am willing to collaborate on the solution if assistance is provided.
Best regards.
The text was updated successfully, but these errors were encountered: