Git Product home page Git Product logo

ovs-cni's Introduction

ovs-cni

Build Status codecov

Introduction

OVS-CNI is a totally Open vSwitch CNI plugin, it create the Open vSwitch and use veth to connect the OpenvSwitch and container.

ovs-cni supports the following options in its config and you can see the example config example/example.conf to learn how to use it.

  1. controller IP
controller:10.245.1.5:6653
  1. target vxlan IP
vtepIPs: [
    "10.245.2.2",
    "10.245.2.3"
]
  1. bridge name
ovsBridge: "br0"
  1. Act as a gateway for pods.
isDefaultGateway: true
  1. Support SNAT for pods traffic.
ipMasq: true
  1. IPAM support

ovs-cni support basic IPAM type such as host-local, you can see example/example.conf to see how config it. Besides, ovs-cni provide a new IPAM plugin central-ip, which use the ETCD to perform centralized IP assignment/management and you can go to ipam/centralip directory to see more usage about it.

Usage

If you are familiar with CNI plugin and know how to use it. you can refer to the following instruction to use it. Otherwise you can go to deployment directory to learn how to use it.

Building ovs-cni

Because ovs-cni used the package management tool called govendor, we have to install the govendor first.

$ go get -u github.com/kardianos/govendor

We use govendor to download all dependencies

$ cd ~/go/src/github.com/John-Lin/ovs-cni
$ govendor sync

build the ovs-cni binary.

$ ./build.sh

and the binary will come out in the /bin directory and you can find ovs and centralip. The ovs is the main CNI plugin and the centralip is the CNI plugin for different IPAM usage. If you want to use ETCD to centralizaed manage the IP address, you should also copy the centralip binary to the CNI directory and modify the config to use it.

$ sudo ip netns add ns1

$ sudo CNI_COMMAND=ADD CNI_CONTAINERID=ns1 CNI_NETNS=/var/run/netns/ns1 CNI_IFNAME=eth2 CNI_PATH=`pwd` ./ovs <example.conf

Use the ovs-cni

Before running the ovs-cni, make sure your system meet the following requirement.

  1. install openvswitch and run it.

  2. download the basic cni binary (local-host) and put they in /opt/cni/bin

Now, we use ip netns to create a basic network namespace as our example.

$ sudo ip netns add ns1

change directory to bin and type following command to start the ovs-cni.

$ sudo CNI_COMMAND=DEL CNI_CONTAINERID=ns1 CNI_NETNS=/var/run/netns/ns1 CNI_IFNAME=eth2 CNI_PATH=/opt/cni/bin ./ovs < ../example/example.conf
$ sudo ip netns exec ns1 ifconfig

Cleanup

$ sudo ip netns del ns1

$ sudo ovs-vsctl del-br br0

ovs-cni's People

Contributors

john-lin avatar mozhuli avatar hwchiu avatar

Watchers

James Cloos avatar Paul Greenberg 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.