{"id":19585299,"url":"https://github.com/libracoder/loadbalancer-on-rasberrypi","last_synced_at":"2026-03-19T10:37:36.795Z","repository":{"id":170182574,"uuid":"646302581","full_name":"libracoder/loadbalancer-on-rasberrypi","owner":"libracoder","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-28T00:20:53.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T12:43:37.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","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/libracoder.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}},"created_at":"2023-05-28T00:11:44.000Z","updated_at":"2023-05-28T00:38:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"1379bb95-f777-422e-8d6d-bfd706c4ccdf","html_url":"https://github.com/libracoder/loadbalancer-on-rasberrypi","commit_stats":null,"previous_names":["libracoder/loadbalancer-on-rasberrypi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/libracoder/loadbalancer-on-rasberrypi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libracoder%2Floadbalancer-on-rasberrypi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libracoder%2Floadbalancer-on-rasberrypi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libracoder%2Floadbalancer-on-rasberrypi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libracoder%2Floadbalancer-on-rasberrypi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libracoder","download_url":"https://codeload.github.com/libracoder/loadbalancer-on-rasberrypi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libracoder%2Floadbalancer-on-rasberrypi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29991884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-11T07:53:36.188Z","updated_at":"2026-03-02T03:35:30.016Z","avatar_url":"https://github.com/libracoder.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Configuring MetalLB on Raspberry Pi\n\nThis readme file provides step-by-step instructions to configure MetalLB, a load balancer implementation for Kubernetes, on a Raspberry Pi cluster. MetalLB allows you to allocate external IP addresses to services running within your cluster.\n\n## Prerequisites\n\nBefore you begin, ensure that you have the following:\n\n- Raspberry Pi cluster with Kubernetes installed.\n- Access to the Raspberry Pi cluster via `kubectl` command-line tool.\n- Helm and kubectl installed on your local machine.\n\n## Steps\n\nFollow the steps below to configure MetalLB on your Raspberry Pi cluster:\n\n1. Create a Kubernetes namespace for MetalLB by adding the following configuration to your Terraform file (`main.tf`):\n\n    ```hcl\n    provider \"helm\" {\n      kubernetes {\n        config_path = \"~/.kube/config\"\n      }\n    }\n\n    provider \"kubernetes\" {\n      config_path    = \"~/.kube/config\"\n      config_context = \"pi\"\n    }\n\n    resource \"kubernetes_namespace\" \"metallb\" {\n      metadata {\n        name = \"metallb\"\n      }\n    }\n    ```\n\n2. Install the MetalLB Helm chart by adding the following configuration to your Terraform file (`main.tf`):\n\n    ```hcl\n    resource \"helm_release\" \"metal_lb\" {\n      name       = \"metallb\"\n      repository = \"https://metallb.github.io/metallb\"\n      chart      = \"metallb\"\n      namespace  = kubernetes_namespace.metallb.metadata[0].name\n\n      set {\n        name  = \"labels.pod-security.kubernetes\\\\.io/enforce\"\n        value = \"privileged\"\n      }\n\n      set {\n        name  = \"labels.pod-security.kubernetes\\\\.io/audit\"\n        value = \"privileged\"\n      }\n\n      set {\n        name  = \"labels.pod-security.kubernetes\\\\.io/warn\"\n        value = \"privileged\"\n      }\n\n      set {\n        name  = \"speaker.secretName\"\n        value = \"memberlist\"\n      }\n    }\n    ```\n\n3. Create a file named `metal-lb-config.yaml` on your local machine and copy the following YAML configuration into it:\n\n    ```yaml\n    ---\n    # Metallb address pool\n    apiVersion: metallb.io/v1beta1\n    kind: IPAddressPool\n    metadata:\n      name: ip-pool\n      namespace: metallb\n    spec:\n      addresses:\n        - 192.168.1.180-192.168.1.240\n    ---\n    # L2 configuration\n    apiVersion: metallb.io/v1beta1\n    kind: L2Advertisement\n    metadata:\n      name: l2-advert\n      namespace: metallb\n    spec:\n      ipAddressPools:\n        - ip-pool\n    ```\n\n4. Add the following Terraform configurations to your `main.tf` file to deploy the `metal-lb-config.yaml` file as Kubernetes manifests:\n\n    ```hcl\n    data \"kubectl_file_documents\" \"metal_lb\" {\n      content = file(\"metal-lb-config.yaml\")\n    }\n\n    resource \"kubectl_manifest\" \"metal_lb\" {\n      for_each  = data.kubectl_file_documents.metal_lb.manifests\n      yaml_body = each.value\n    }\n    ```\n\n5. Now lets test our deployment, Create a file named `nginx-deployment.yaml` on your local machine and copy the following YAML configuration into it:\n\n    ```yaml\n   apiVersion: apps/v1\n    kind: Deployment\n    metadata:\n      name: nginx\n    spec:\n      selector:\n        matchLabels:\n          app: nginx\n      template:\n        metadata:\n          labels:\n            app: nginx\n        spec:\n          containers:\n            - name: nginx\n              image: nginx:1\n              ports:\n                - name: http\n                  containerPort: 80\n    ---\n    apiVersion: v1\n    kind: Service\n    metadata:\n      name: nginx\n    spec:\n      ports:\n        - name: http\n          port: 80\n          protocol: TCP\n          targetPort: 80\n      selector:\n        app: nginx\n      type: LoadBalancer\n   ```\n6. Add the following Terraform configurations to a new file called `test-deployment.tf` file to deploy the `nginx-deployment.yaml` file as Kubernetes manifests:\n\n    ```hcl\n    data \"kubectl_file_documents\" \"test-deployment\" {\n    content = file(\"test-deployment.yaml\")\n    }\n    \n    resource \"kubectl_manifest\" \"test-deployment\" {\n    for_each  = data.kubectl_file_documents.test-deployment.manifests\n    yaml_body = each.value\n    }\n    ```\n7. Run ``kubectl get svc nginx`` should show you the nginx service with an external Ip to access the instance\n    ``` typescript\n    kubecl get svc nginx\n    NAME    TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)        AGE\n    nginx   LoadBalancer   10.43.217.91   192.168.1.181   80:30415/TCP   48m\n\n   ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibracoder%2Floadbalancer-on-rasberrypi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibracoder%2Floadbalancer-on-rasberrypi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibracoder%2Floadbalancer-on-rasberrypi/lists"}