Thursday, May 12, 2016

docker vlan with socketplane on bare-metal node

multi-host networking between Dockerhosts using Open vSwitch and Consul as core enablers by building VXLAN tunnels between hosts to connect docker containers on the same virtual(logical) network with no remote/external SDN controller needed

it will install OVS and Docker and start a socketplane container that runs Consul for managing network state




install

1: git clone https://github.com/socketplane/socketplane

2: chmod u+x scripts/install.sh

3:first node
sudo BOOTSTRAP=true ./scripts/install.sh 
Subsequent Nodes:
3: sudo ./scripts/install.sh

4: sudo socketplane run -itd ubuntu

5: sudo socketplane network list



UNinstall

sudo socketplane uninstall


 cgroups

The first step, on Ubuntu, is to install the cgroups packages:
sudo apt-get install cgroup-bin cgroup-lite libcgroup1
This creates a few files for you. Notably:
  • /sys/fs/cgroup is created, which has a bunch of folders in a sort of virtual filesystem that "represents" your cgroup.
  • /etc/init/cgroup-lite.conf. cgroup-lite.conf creates the /sys/fs/cgroup directory, based on the contents of
  • /proc/cgroups, which specifies what groups cgroup-lite should create.

 cgroup created on boot


Here's what I ended up putting in my /etc/cgconfig.conf:
group limitgroup {
  perm {
    admin {
      uid = root;
      gid = root;
    }
    task {
      uid = 1001;
      gid = 1001;
    }  
  }
  cpu {
    cpu.shares = "768";
  }
  memory {
    memory.limit_in_bytes = "3G";
  }            
}
cgconfigparser -l /etc/cgconfig.conf
This parses and then "executes" your cgconfig file; that is, if it parses correctly, it'll create your groups. I fought with creating mount directives in this file for quite a few reboots, but finally I just modified my /etc/init/cgroup-lite.conf and added the cgconfigparser -l /etc/cgconfig.conf line below the /bin/cgroups-mount line. So the modified contents of the pre-start section in /etc/init/cgroup-lite.conf file looked like
pre-start script
        test -x /bin/cgroups-mount || { stop; exit 0; }
        test -d /sys/fs/cgroup || { stop; exit 0; }
        /bin/cgroups-mount
        cgconfigparser -l /etc/cgconfig.conf
end script

No comments:

Post a Comment