In this recipe, you will learn how to enable CNI, which is a common interface used by different container runtimes to provide network isolation and configuration for containers.
You need to have Mesos up and running. See the recipes of Chapter 1, Getting Started with Apache Mesos to get more information.
CNI is enabled by default in Mesos. All we need is to download the plugins we want to use and provide configuration. Create two directories; one for plugins and one for configuration:
mkdir -p /etc/mesos-slave/cni/plugins
mkdir -p /etc/mesos-slave/cni/config
Then download and un-compress the plugins:
wget https://github.com/containernetworking/cni/releases/download/v0.3.0/cni-v0.3.0.tgz tar xvf cni-v0.3.0.tgz -C /etc/mesos-slave/cni/plugins
Write simple config that will create a bridged subnetwork with the IP range 172.16.28.0/24
and the ability to talk with external networks through NAT:
cat << EOF > /etc/mesos-slave/cni/config...