diff --git a/site/cni-plugin.md b/site/cni-plugin.md index 05a4c6f1..dcc9850c 100644 --- a/site/cni-plugin.md +++ b/site/cni-plugin.md @@ -1,13 +1,14 @@ --- -title: Integrating Kubernetes via the CNI Plugin +title: Weave CNI Plugin menu_order: 65 --- -CNI, the [_Container Network Interface_](https://github.com/appc/cni#cni---the-container-network-interface), +CNI, the [_Container Network Interface_](https://github.com/containernetworking/cni), is a proposed standard for configuring network interfaces for Linux application containers. CNI is supported by -[Kubernetes](http://kubernetes.io/), an open source container cluster -manager built by Google. +[Kubernetes](http://kubernetes.io/), [Apache Mesos](mesos.apache.org) +and +[others](https://github.com/containernetworking/cni#who-is-using-cni). ###Installing the Weave Net CNI plugin @@ -23,7 +24,7 @@ Then run: weave setup -###Launching Weave Net +####Launching Weave Net To create a network which can span multiple hosts, the Weave peers must be connected to each other, by specifying the other hosts during `weave launch` or via [`weave connect`](/site/using-weave/finding-adding-hosts-dynamically.md). @@ -36,20 +37,7 @@ perform some additional configuration of the Weave bridge: weave launch weave expose -###Configuring Kubernetes to use the CNI Plugin - -After you've launched Weave and peered your hosts, you can configure -Kubernetes to use Weave, by adding the following options to the -`kubelet` command: - - --network-plugin=cni --network-plugin-dir=/etc/cni/net.d - -See the [`kubelet` documentation](http://kubernetes.io/v1.1/docs/admin/kubelet.html) -for more details. - -Now, whenever Kubernetes starts a pod, it will be attached to the Weave network. - -###Using the CNI network configuration file +####Using the CNI network configuration file All CNI plugins are configured by a JSON file in the directory `/etc/cni/net.d/`. `weave setup` installs a minimal configuration @@ -70,6 +58,47 @@ The following other fields in the spec are supported: - `ipam / subnet` - default is to use Weave's IPAM default subnet - `ipam / gateway` - default is to use the Weave bridge IP address (allocated by `weave expose`) +###Using the Weave Net CNI plugin + +####Configuring Kubernetes to use the CNI Plugin + +After you've launched Weave and peered your hosts, you can configure +Kubernetes to use Weave, by adding the following options to the +`kubelet` command: + + --network-plugin=cni --network-plugin-dir=/etc/cni/net.d + +See the [`kubelet` documentation](http://kubernetes.io/v1.1/docs/admin/kubelet.html) +for more details. + +Now, whenever Kubernetes starts a pod, it will be attached to the Weave network. + +####Configuring Mesos to use the CNI plugin + +To use the CNI plugin, the Mesos Agent must be started with reference +to the CNI configuration and binary directories: + + sudo mesos-slave + --network_cni_config_dir=/etc/cni/net.d + --network_cni_plugins_dir=/opt/cni/bin + ... + +To start a container that is connected to the Weave network via CNI, +use the name specified in the configuration file. This example starts +a alpine container running a `nc` server listening on port 1080 with +the `mesos-execute` command. From the Master, run: + + nohup sudo mesos-execute --command="ifconfig; nc -k -l 0.0.0.0 1080" --docker_image=alpine --master=localhost:5050 --name=example --networks=weave --resources=cpus:0.1 --shell test.log 2>&1 & + +After this task has started, it is possible to obtain the ip address of +the container and ping it from any of other agents (which are also +connected to the weave network)" + + nc -z -v 1080 + +For more information, see the +[Mesos documentation](http://mesos.apache.org/documentation/cni/). + ###Caveats - The Weave Net router container must be running for CNI to allocate addresses