Skip to content

logingood/bagpipe-cni

Repository files navigation

BaGPipe BGP CNI plugin

Overview

This plugins allows to confiure container networking with VXLAN and advertise container's network as VXLAN + IP + Mac object using EVPN BGP route. You must have bagpipe-bgp installed on the host machine:

BaGPipe BGP

Probably have a route reflector (BGP router that supports AFI=25 SAFI=70) because bagpipe-bgp allows only to run two nodes without RR.

Nice example of go-based RR: GoBGP and EVPN lab example can be found here EVPN with BaGPipe BGP and GoBGP RR

Install

Option 1

Use go get:

go get github.com/murat1985/bagpipe-cni

package would be installed into your $GOBIN path, e.g.:

/usr/local/go/bin

Bare in mind if you are going to use it with Kubernetes plugin should reside in /opt/cni/bin

Option 2

The second way to install plugin altogether with other CNI plugins and IPAM plugins. Clone CNI repositority: CNI

Make sure that GOPATH environment variable is set

cd $GOPATH
git clone https://github.com/containernetworking/cni
cd cni/plugins/main

Clone bagpipe CNI plugin into plugins/main/bagpipe

git clone https://github.com/murat1985/bagpipe-bgp bagpipe
cd ../../

Build plugins

./build

Example configuration

Supported IP manager plugins:

Just put the example below in file /etc/cni/net.d/10-mynet.conf

{
  "name": "mynet",
  "type": "bagpipe",
  "importrt": "64512:90",
  "exportrt": "64512:90",
  "isGateway": false,
  "ipMasq": false,
  "mtu": "1500", 
    "ipam": {
      "type": "host-local",
      "subnet": "10.1.2.0/24",
      "routes": [
        { "dst": "0.0.0.0/0" }
      ]
    }
}

Network configuration reference

  • name (string, required): the name of the network.
  • type (string, required): "bagpipe".
  • importrt (string, required): import community
  • exportrt (string, required): export community
  • mtu (integer, optional): explicitly set MTU to the specified value. Defaults to the value chosen by the kernel.

Usage with Kubernetes

I have published a blog post, where described PoC: BaGPipe CNI and Kubernetes

Usage with Docker

Assuming that cni installed in the $GOPATH/cni and bagpipe CNI plugin is installed in plugins/main/bagpipe docker-run.sh script could be found in scripts directory of CNI repository

cd $GOPATH/cni
CNI_PATH=`pwd`/bin
./build; cd scripts; CNI_PATH=$CNI_PATH ./docker-run.sh busybox ifconfig eth0 ; cd ..

Adding and Deleting of bagpipe tunnels along with container links fully implemented.

Diagram

alt text

TODO

  1. GW allocation (relying on BaGPipe BGP as it is responsible to create a bridge and vxlan interfaces)