{"id":13543505,"url":"https://github.com/fnproject/lb","last_synced_at":"2026-01-14T13:13:56.223Z","repository":{"id":87295993,"uuid":"118024269","full_name":"fnproject/lb","owner":"fnproject","description":"Fn loadbalancer","archived":true,"fork":false,"pushed_at":"2019-03-01T20:33:54.000Z","size":28653,"stargazers_count":17,"open_issues_count":3,"forks_count":4,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-04-16T07:22:59.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnproject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-01-18T18:53:35.000Z","updated_at":"2023-12-10T17:16:00.000Z","dependencies_parsed_at":"2023-03-10T18:15:15.776Z","dependency_job_id":null,"html_url":"https://github.com/fnproject/lb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fnproject/lb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Flb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Flb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Flb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Flb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnproject","download_url":"https://codeload.github.com/fnproject/lb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Flb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T11:00:32.403Z","updated_at":"2026-01-14T13:13:56.216Z","avatar_url":"https://github.com/fnproject.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Fn Load Balancer\n\n# THIS REPO IS DEPRECATED AND NOT RECOMMENDED FOR USE OF ANY KIND, SEE https://github.com/fnproject/docs/blob/master/fn/operate/runner_pools.md FOR USING FN WITH AN LB\n\nThe Fn Load Balancer (Fn LB) allows operators to deploy clusters of Fn servers and route traffic to them intelligently. Most importantly, it will route traffic to nodes where hot functions are running to ensure optimal performance, as well as distribute load if traffic to a specific function increases. It also gathers information about the entire cluster which you can use to know when to scale out (add more Fn servers) or in (decrease Fn servers).\n\n## Load balancing several Fn servers\nYou can run multiple Fn instances and balance the load amongst them using `fnlb` as follows:\n\n```sh\nfnlb --listen \u003caddress-for-incoming\u003e --nodes \u003cnode1\u003e,\u003cnode2\u003e,\u003cnode3\u003e\n```\n\nAnd redirect all traffic to the load balancer.\n\n**NOTE: For the load balancer to be of use, all function nodes need to be sharing the same DB.**\n\n## Running with docker\n\nTo build a docker image for `fnlb` just run:\n\n```\nmake docker-build\n```\n\nTo start the `fnlb` proxy with the addresses of functions nodes in a docker\ncontainer:\n\n```sh\ndocker run -d --name fnlb -p 8081:8081 fnproject/lb:latest --nodes \u003cnode1\u003e,\u003cnode2\u003e\n```\n\nIf running locally with functions servers in docker, running with docker links\ncan make things easier (can use local addresses). for example:\n\n```sh\ndocker run -d --name fn-8080 --privileged -p 8080:8080 fnproject/fnserver:latest\ndocker run -d --name fnlb --link fn-8080 -p 8081:8081 fnproject/lb:latest --nodes 127.0.0.1:8080\n```\n\n## Operating / usage\n\nTo make functions requests against the lb with the cli:\n\n```sh\nFN_API_URL=http://\u003cfnlb_address\u003e fn call my/function\n```\n\nTo add a functions node later:\n\n```sh\ncurl -sSL -X PUT -d '{\"node\":\"\u003cnode\u003e\"}' \u003cfnlb_address\u003e/1/lb/nodes\n```\n\n`\u003cnode\u003e` should be the address of a functions server. The lb will health check\nthis and log if it cannot reach that node as well as stop sending requests to\nthat node until it begins passing health checks again. Any number of functions\nservers may be added to the load balancer.\n\nTo permanently remove a functions node:\n\n```sh\ncurl -sSL -X DELETE -d '{\"node\":\"\u003cnode\u003e\"}' \u003cfnlb_address\u003e/1/lb/nodes\n```\n\nTo list functions nodes and their state:\n\n```sh\ncurl -sSL -X GET \u003cfnlb_address\u003e/1/lb/nodes\n```\n\n## Running under Kubernetes\n\nThe fnlb supports a mode of operation which relies on Kubernetes to inform it as Fn pods come in and out of service. In order to run in this mode, some additional command-line flags are required. `-db=k8s` will select Kubernetes operation; in this mode, the `nodes` flag is ignored. `-label-selector=...` is a standard Kubernetes selector expression.\n\nA sample k8s configuration follows; this expects Fn pods to be labelled `app=fn,role=fn-service`. By default, the lb will look in its own namespace for Fn pods. This can be changed by explicitly passing the `-namespace=...` option.\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: fn-service\n  namespace: fn\n  labels:\n    app: fn\n    role: fn-lb\nspec:\n  type: NodePort\n  ports:\n  - name: fn-service\n    port: 8080\n    targetPort: 8080\n    nodePort: 32180\n  selector:\n    app: fn\n    role: fn-lb\n---\napiVersion: extensions/v1beta1\nkind: DaemonSet\nmetadata:\n  name: fn-lb\n  namespace: fn\nspec:\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      maxUnavailable: 1\n  minReadySeconds: 30\n  template:\n    metadata:\n      labels:\n        app: fn\n        role: fn-lb\n    spec:\n      containers:\n      - name: fn-lb\n        image: fnproject/fnlb\n        imagePullPolicy: Always\n        args:\n        - \"-db=k8s\"\n        - \"-label-selector=app=fn,role=fn-service\"\n        - \"-listen=:8080\"\n        - \"-mgmt-listen=:8080\"\n        ports:\n        - containerPort: 8080\n        env:\n        - name: LOG_LEVEL\n          value: debug\n\n```\n\nIn this mode, the shared database is not required; each lb will listen to the Kubernetes master independently to derive the same information. The lb nodes continue to health-check Fn pods *in addition* to the health checks running directly as part of a Pod definition.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnproject%2Flb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnproject%2Flb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnproject%2Flb/lists"}