{"id":19595410,"url":"https://github.com/meta-magic/metallb-baremetal-example","last_synced_at":"2025-04-27T15:34:32.898Z","repository":{"id":100692318,"uuid":"199169834","full_name":"meta-magic/metallb-baremetal-example","owner":"meta-magic","description":"Kubernetes On Premise Implementation with Metal LB (metallb) + Cilium and Istio","archived":false,"fork":false,"pushed_at":"2019-09-09T09:52:49.000Z","size":80,"stargazers_count":30,"open_issues_count":0,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T01:11:13.566Z","etag":null,"topics":["cilium","kubernetes","kubernetes-cluster","kubernetes-on-premise","metallb","nginx-ingress-controller"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/meta-magic.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":"2019-07-27T13:42:13.000Z","updated_at":"2024-10-09T12:35:18.000Z","dependencies_parsed_at":"2023-08-01T19:03:28.152Z","dependency_job_id":null,"html_url":"https://github.com/meta-magic/metallb-baremetal-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-magic%2Fmetallb-baremetal-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-magic%2Fmetallb-baremetal-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-magic%2Fmetallb-baremetal-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-magic%2Fmetallb-baremetal-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meta-magic","download_url":"https://codeload.github.com/meta-magic/metallb-baremetal-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251162982,"owners_count":21545857,"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":["cilium","kubernetes","kubernetes-cluster","kubernetes-on-premise","metallb","nginx-ingress-controller"],"created_at":"2024-11-11T08:46:48.867Z","updated_at":"2025-04-27T15:34:32.865Z","avatar_url":"https://github.com/meta-magic.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Metallb ON-PREMISE with Cilium  \n\n## - Using Nginx ingress controller \n## - Using [Istio Service Mesh](https://github.com/meta-magic/metallb-baremetal-example/tree/master/istio) - Recommended\n\nKubernetes implementation in the cloud services like Amazon (EKS), Google (GKE) or Azure (AKS) provides out of the box capabilities like Multi-Master High Availability, Ingress Load Balancer (to handle in the traffic from the internet), Network Storage, and launching worker nodes with different hardware requirements. \n\nAll these facilities will NOT available if you install Kubernetes Clusters On-Premise if the infrastructure team uses an IaaS (Infrastructure as a Service) and builds the Kubnernetes cluster on bare metal. \n\nThis section will focus on how to deploy an Ingress enabled Load Balancer (at the Gateway) to handing the incoming traffic to the cluster. \n\nBare metal cluster operators have left with two lesser tools to bring user traffic into their clusters, “NodePort” and “externalIPs” services. Both of these options have significant downsides for production use, which makes bare metal clusters second class citizens in the Kubernetes ecosystem. (From metallb web site).\n\nMetalLB is a load-balancer implementation for bare metal Kubernetes clusters, using standard routing protocols.\n\nTHe following section focuses Metal LB with Nginx Ingress Controller. If you want Metal LB with Istio (with Istio Ingress Controller) then [click here \u003e Istio Service Mesh](https://github.com/meta-magic/metallb-baremetal-example/tree/master/istio). The recommended option is Metal LB with Istio. \n\nUnder Nginx, we have a simple hello world example while under Istio we have a much more powerful example to demonstrate. \n\n## MetalLB requires the following to function:\n\n1) A Kubernetes cluster, running Kubernetes 1.13.0 or later, that does not already have network load-balancing functionality.\n\n2) A cluster network configuration that can coexist with MetalLB.\n\n3)  IPv4 addresses for MetalLB .\n\n4) Depending on the operating mode, you may need one or more routers capable of speaking BGP.\n\n\n## 1. Kubernetes Setup\n\nA Kubernetes cluster: v1.15.1 (3 node cluster) is already set ready.\n\n\n## 2. Install Cilium Network Driver \n\ncluster network configuration : cilium \n\n```bash\n$ kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.14/cilium.yaml\n```\n\n## 3. Install Metallb \n\n```bash\n$ kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.8.1/manifests/metallb.yaml\n```\n\n(Reference https://metallb.universe.tf/installation/)\n\nThis will deploy MetalLB to your cluster, under the metallb-system namespace. \n\n### 3.1 Metal LB Components\n\n1) The metallb-system/controller deployment. (This is the cluster-wide controller that handles IP address assignments.)\n\n2) The metallb-system/speaker daemonset. (This is the component that speaks the protocol(s) of your choice to make the services reachable)\n\n3) Service accounts for the controller and speaker, along with the RBAC permissions that the components need to function.\n\n![Screenshot from 2019-07-30 11-12-16](https://user-images.githubusercontent.com/30106168/62108245-35102f80-b2c7-11e9-996e-4542a9d6d607.png)\n\n### 3.2 Verify the speaker and controller are running state:\n\n![Screenshot from 2019-07-30 11-12-40](https://user-images.githubusercontent.com/30106168/62108461-b962b280-b2c7-11e9-97fc-5ace03d32aef.png)\n\n### 3.3 Add configMap\n\nMetalLB’s components  will remain idle until you define and deploy a configmap.(for demo we will be using layer2 configuration)\n\n```bash\n$ kubectl apply -f  https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/metallb_install/configMap_example.yml\n```\n\n## 4. Install Nginx Ingress Controller\n\n### 4.1 Install nginx Controller\n\n```bash\n$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/nginx-ingress/nginx_controller_install.yml\n```\n\n### 4.2 Create nginx Ingress Service (Type: Load Balancer)\n\n```bash\n$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/nginx-ingress/nginx_ingress_svc.yml\n```\n\n![Screenshot from 2019-07-30 11-20-44](https://user-images.githubusercontent.com/30106168/62110414-f6c93f00-b2cb-11e9-8cea-310aff24eb37.png)\n\n\n## 5. Create demo of hello-world\n\n1) Create a namespace  helloworld\n\n```bash\n$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-world-ns.yml\n```\n\n2) Create a Pod (In production always use Deployment)\n\n```bash\n$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-pod.yml\n```\n\n3) Create Service (with default cluster IP)\n\n```bash\n$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-svc.yml\n```\n\n![Screenshot from 2019-07-30 11-29-11](https://user-images.githubusercontent.com/30106168/62110568-57f11280-b2cc-11e9-961a-e3d51014d268.png)\n\n4) Expose the Service by creating an Ingress \n\n```bash\n$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-ing.yml\n```\n\n## 6. Verify the IP of ingress\n\n```bash\n$ kubectl get ing -n helloworld\n```\n\n![Screenshot from 2019-07-30 11-29-45](https://user-images.githubusercontent.com/30106168/62110702-a2728f00-b2cc-11e9-8298-1d75ced33da4.png)\n\n## 7. Access url http://192.168.2.8 (IP of ingress)\n\n\n![Screenshot from 2019-07-30 13-33-04](https://user-images.githubusercontent.com/30106168/62114793-f97c6200-b2d4-11e9-9e5a-23d00eab4790.png)\n\n## License\n\nLicensed under the [Apache 2.0](http://www.amexio.org/metamagic-showcase/license.html)  License. [ by [CC By 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)\n\n**Enjoy!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeta-magic%2Fmetallb-baremetal-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeta-magic%2Fmetallb-baremetal-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeta-magic%2Fmetallb-baremetal-example/lists"}