# How SoundCloud Uses HAProxy with Kubernetes for User-Facing Traffic

DevFeed: [How SoundCloud Uses HAProxy with Kubernetes for User-Facing Traffic](<https://devfeed.tech/articles/how-soundcloud-uses-haproxy-with-kubernetes-for-user-facing-traffic-2048.md>)

Original publisher: [Read original article](<https://developers.soundcloud.com/blog//how-soundcloud-uses-haproxy-with-kubernetes-for-user-facing-traffic>)

Published: 2017-12-07T00:00:00Z

Content type: article

Language: en

Sources: [SoundCloud Backstage](<https://devfeed.tech/sources/soundcloud-backstage-blog.md>)

Topics: [Kubernetes](<https://devfeed.tech/topics/kubernetes.md>), [Deployment & Scaling](<https://devfeed.tech/topics/deployment-scaling.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [applications](<https://devfeed.tech/tags/applications.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [cdn](<https://devfeed.tech/tags/cdn.md>), [cluster](<https://devfeed.tech/tags/cluster.md>), [clusters](<https://devfeed.tech/tags/clusters.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [configure](<https://devfeed.tech/tags/configure.md>), [data-center](<https://devfeed.tech/tags/data-center.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [deployment-scaling](<https://devfeed.tech/tags/deployment-scaling.md>), [developers](<https://devfeed.tech/tags/developers.md>), [dns](<https://devfeed.tech/tags/dns.md>), [edge](<https://devfeed.tech/tags/edge.md>), [haproxy](<https://devfeed.tech/tags/haproxy.md>), [has](<https://devfeed.tech/tags/has.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [management](<https://devfeed.tech/tags/management.md>), [microservices](<https://devfeed.tech/tags/microservices.md>), [platform](<https://devfeed.tech/tags/platform.md>), [scaling](<https://devfeed.tech/tags/scaling.md>), [traffic](<https://devfeed.tech/tags/traffic.md>)

## AI overview

SoundCloud routed public traffic to Kubernetes workloads in physical data centers by having HAProxy terminators send requests to NodePorts exposed on cluster nodes. A configuration generator queries Kubernetes for each service's NodePort and node list, then uses rendezvous hashing to choose a stable, service-specific subset of nodes. This reduced the tens of thousands of health checks produced when every terminator checked every node. A node agent using HAProxy's agent-check protocol shifts traffic away when a node is cordoned; service annotations also let operators adjust backend weights within seconds, including across deployments or clusters. SoundCloud found its initial HAProxy Ingress layer unreliable for high-volume traffic, difficult to keep aligned with terminator routing, and unsuitable for some long-lived connections. The NodePort approach has uneven load distribution across application instances, which SoundCloud compensates for by over-provisioning. Node replacement requires a several-hour automated configuration pipeline, and only a limited number of nodes can be replaced daily. NodePorts also cannot be removed from an existing Service; recovery so far has required re-

## Source excerpt

A little less than two years ago, SoundCloud began the journey of replacing our homegrown deployment platform, Bazooka, with Kubernetes. Kubernetes automates deployment, scaling, and management of containerized applications.