Code Monkey home page Code Monkey logo

metallb-baremetal-example's Introduction

Metallb ON-PREMISE with Cilium

- Using Nginx ingress controller

- Using Istio Service Mesh - Recommended

Kubernetes 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.

All 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.

This section will focus on how to deploy an Ingress enabled Load Balancer (at the Gateway) to handing the incoming traffic to the cluster.

Bare 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).

MetalLB is a load-balancer implementation for bare metal Kubernetes clusters, using standard routing protocols.

THe following section focuses Metal LB with Nginx Ingress Controller. If you want Metal LB with Istio (with Istio Ingress Controller) then click here > Istio Service Mesh. The recommended option is Metal LB with Istio.

Under Nginx, we have a simple hello world example while under Istio we have a much more powerful example to demonstrate.

MetalLB requires the following to function:

  1. A Kubernetes cluster, running Kubernetes 1.13.0 or later, that does not already have network load-balancing functionality.

  2. A cluster network configuration that can coexist with MetalLB.

  3. IPv4 addresses for MetalLB .

  4. Depending on the operating mode, you may need one or more routers capable of speaking BGP.

1. Kubernetes Setup

A Kubernetes cluster: v1.15.1 (3 node cluster) is already set ready.

2. Install Cilium Network Driver

cluster network configuration : cilium

$ kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.5/examples/kubernetes/1.14/cilium.yaml

3. Install Metallb

$ kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.8.1/manifests/metallb.yaml

(Reference https://metallb.universe.tf/installation/)

This will deploy MetalLB to your cluster, under the metallb-system namespace.

3.1 Metal LB Components

  1. The metallb-system/controller deployment. (This is the cluster-wide controller that handles IP address assignments.)

  2. The metallb-system/speaker daemonset. (This is the component that speaks the protocol(s) of your choice to make the services reachable)

  3. Service accounts for the controller and speaker, along with the RBAC permissions that the components need to function.

Screenshot from 2019-07-30 11-12-16

3.2 Verify the speaker and controller are running state:

Screenshot from 2019-07-30 11-12-40

3.3 Add configMap

MetalLB’s components will remain idle until you define and deploy a configmap.(for demo we will be using layer2 configuration)

$ kubectl apply -f  https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/metallb_install/configMap_example.yml

4. Install Nginx Ingress Controller

4.1 Install nginx Controller

$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/nginx-ingress/nginx_controller_install.yml

4.2 Create nginx Ingress Service (Type: Load Balancer)

$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/nginx-ingress/nginx_ingress_svc.yml

Screenshot from 2019-07-30 11-20-44

5. Create demo of hello-world

  1. Create a namespace helloworld
$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-world-ns.yml
  1. Create a Pod (In production always use Deployment)
$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-pod.yml
  1. Create Service (with default cluster IP)
$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-svc.yml

Screenshot from 2019-07-30 11-29-11

  1. Expose the Service by creating an Ingress
$ kubectl create -f https://raw.githubusercontent.com/meta-magic/metallb-baremetal-example/master/helloworld_example/hello-ing.yml

6. Verify the IP of ingress

$ kubectl get ing -n helloworld

Screenshot from 2019-07-30 11-29-45

7. Access url http://192.168.2.8 (IP of ingress)

Screenshot from 2019-07-30 13-33-04

License

Licensed under the Apache 2.0 License. [ by CC By 4.0

Enjoy!

metallb-baremetal-example's People

Contributors

arafkarsh avatar deepali-arvind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.