Skip to content

Mininet and containernet fork connecting to Kind for Kubernetes cluster emulation.

License

Notifications You must be signed in to change notification settings

bingzheliu/miniature

Repository files navigation

Miniature

Miniature: Containernet fork that allows to use Kubernete cluster nodes as hosts in emulated networks

Miniature leverage Kind to bootstrap kubernetes clusters, where each container represent a kubernete node. These containers are connect through Containernet to construct emulated networks.

The features that are supported by Containernet are also supported in Miniature.


Features

  • Add a Kubernete cluster (currently only supporting Kind) to Mininet topologies

Following are what supported by Containernet

  • Add, remove Docker containers to Mininet topologies
  • Connect Docker containers to topology (to switches, other containers, or legacy Mininet hosts)
  • Execute commands inside containers by using the Mininet CLI
  • Dynamic topology changes
    • Add hosts/containers to a running Mininet topology
    • Connect hosts/docker containers to a running Mininet topology
    • Remove Hosts/Docker containers/links from a running Mininet topology
  • Resource limitation of Docker containers
    • CPU limitation with Docker CPU share option
    • CPU limitation with Docker CFS period/quota options
    • Memory/swap limitation
    • Change CPU/mem limitations at runtime!
  • Expose container ports and set environment variables of containers through Python API
  • Traffic control links (delay, bw, loss, jitter)
  • Automated installation based on Ansible playbook

Installation

Install Containernet

Automatic installation is provided through an Ansible playbook.

Requires: Ubuntu Linux 18.04 LTS and Python3 Experimental: Ubuntu Linux 20.04 LTS and Python3

$ sudo apt-get install ansible git aptitude
$ git clone https://github.com/violetbingzhe/miniature
$ cd miniature/ansible
$ sudo ansible-playbook -i "localhost," -c local install.yml
$ cd ..

Wait (and have a coffee) ...

You can switch between development (default) and normal installation as follows:

sudo make develop
# or 
sudo make install

Install Kind

Follow instruction from here: https://github.com/kubernetes-sigs/kind

Examples

Usage example

Start example topology with one Docker container and two kubernetes nodes connected to the network.

  • run: sudo python3 kube_example_kind.py

Topology example

In your custom topology script you can add kubernete cluster like this:

net = KubeSim(controller=Controller)
info('*** Adding docker containers\n')
# config is optional
net.addKubeCluster("test", config = "config/kind.yaml")
# adding a control plane node
k1 = net.addKubeNode("test", "k1", role = "control-plane", type = "kind")
# adding a worker node
k2 = net.addKubeNode("test", "k2", role = "worker", type = "kind")
# can add a docker container into the topology
d1 = net.addDocker('d1', ip='172.18.0.10', dimage="ubuntu:trusty")

For more features, you could find it on Mininet or Containernet website.

Documentation

More details TBD.

Contact

Developer

Bingzhe Liu

  • Mail: <bingzhe (at) illinois (dot) edu>

About

Mininet and containernet fork connecting to Kind for Kubernetes cluster emulation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published