{"id":20637586,"url":"https://github.com/huang-wei/shared-loadbalancer","last_synced_at":"2025-07-14T15:06:01.401Z","repository":{"id":147371169,"uuid":"153693168","full_name":"Huang-Wei/shared-loadbalancer","owner":"Huang-Wei","description":"Demo for 2018 KubeCon NA","archived":false,"fork":false,"pushed_at":"2019-06-29T19:37:42.000Z","size":464,"stargazers_count":22,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-07T11:11:02.999Z","etag":null,"topics":["kubecon","kubernetes","loadbalancer","service"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Huang-Wei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-18T22:05:13.000Z","updated_at":"2023-11-03T22:26:27.000Z","dependencies_parsed_at":"2023-07-06T12:45:55.260Z","dependency_job_id":null,"html_url":"https://github.com/Huang-Wei/shared-loadbalancer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Huang-Wei/shared-loadbalancer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huang-Wei%2Fshared-loadbalancer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huang-Wei%2Fshared-loadbalancer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huang-Wei%2Fshared-loadbalancer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huang-Wei%2Fshared-loadbalancer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Huang-Wei","download_url":"https://codeload.github.com/Huang-Wei/shared-loadbalancer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huang-Wei%2Fshared-loadbalancer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265311795,"owners_count":23745142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubecon","kubernetes","loadbalancer","service"],"created_at":"2024-11-16T15:15:11.818Z","updated_at":"2025-07-14T15:06:01.376Z","avatar_url":"https://github.com/Huang-Wei.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shared Kubernetes LoadBalancer\n\n## Background\n\nWe know that in Kubernetes, there are generally 3 ways to expose workloads publicly:\n\n- Service (with type `NodePort`)\n- Service (with type `LoadBalancer`)\n- Ingress\n\n\u003e kubectl proxy and similar dev/debug solutions are not counted in.\n\n`NodePort` Service comes almost as early as born of Kubernetes. But due to limitation on ports range (30000~32767), randomness of port, and the need to expose public network of (almost) the whole cluster, `NodePort` Service is usually not considered as a good L4 solution in serious production workloads.\n\nA viable solution today for L4 apps is `LoadBalancer` service. It's implemented differently in different Kubernetes offerings, by connecting an Kubernetes Service object with a real/virtual IaaS LoadBalancer, so that traffic going through LoadBalancer endpoint can be routed to destination pods properly.\n\nHowever, in reality, L7 (e.g. HTTP) workloads are way more widely used than L4 ones. So community comes up with the `Ingress` concept. `Ingress` object defines how incoming request can be routed to internal Service, and under the hood there is an ingress controller (1) dealing with `Ingress` objects, setting up mapping rules by leveraging Nginx/Envoy/etc. and also (2) (normally) exposing via `LoadBalancer` externally.\n\n\u003e There is a misunderstanding that using Ingress, it's also doable to manage L4 workloads. It's not true. Why Ingress can work is b/c it can differentiate requests by HTTP headers, but for a L4 packet, it's only ip + port.\n\n## Motivation\n\nIngress introduces a possibility which enables you to expose multiple internal L7 services through **one** public endpoint. But it doesn't work for L4 workloads.\n\n![](docs/pics/4-dimensions.png)\n\nFrom the above picture, you might wonder where's the missing piece for L4 services? This is exactly the problem we're trying to solve in this project. And following factors are considered:\n\n- Cost effective\n- User friendly\n- Reusing existing Kubernetes assets\n- Minimum operation efforts\n- Consistent with Kubernetes roadmap\n\n## How It Works\n\nWe introduce a \"SharedLoadBalancer Controller\" to customize current Kubernetes behavior.\n\nWithout a \"SharedLoadBalancer Controller\", it's N Services (of type LoadBalancer) mapped to N LoadBalancer endpoints:\n\n![](docs/pics/current-lb.png)\n\nWith a \"SharedLoadBalancer Controller\", it's N SharedLB CR objects mapped to 1 LoadBalancer endpoint (on different ports):\n\n![](docs/pics/shared-lb.png)\n\n## More Info\n\nWant to get more info on this? Join us at KubeCon + CloudNativeCon North America 2018 in Seattle, December 11-13, we will be giving a [session](https://sched.co/GrUd) on this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuang-wei%2Fshared-loadbalancer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuang-wei%2Fshared-loadbalancer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuang-wei%2Fshared-loadbalancer/lists"}