From ef892fd4ed2d8743bab6499ac58debb5e5a84973 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Fri, 11 Mar 2016 13:17:04 +0000 Subject: [PATCH] Docs for CNI plugins --- site/features.md | 8 ++++ site/plugin/cni-plugin-how-to.md | 77 ++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 site/plugin/cni-plugin-how-to.md diff --git a/site/features.md b/site/features.md index 79bad582..57e55add 100644 --- a/site/features.md +++ b/site/features.md @@ -10,6 +10,7 @@ Net: * [Fast Data Path](#fast-data-path) * [Seamless Docker Integration](#docker) * [Docker Network Plugin](#plugin) + * [CNI Plugin](#cniplugin) * [Address Allocation (IPAM)](#addressing) * [Naming and Discovery](#naming-and-discovery) * [Application Isolation](#application-isolation) @@ -100,6 +101,13 @@ when there are network connectivity problems. See [Using the Weave Docker Network Plugin](/site/plugin/weave-plugin-how-to.md) for more details. +###Weave Network CNI Plugin + +Weave can be used as a plugin to systems that support the [Container Network Interface](https://github.com/appc/cni), such as Kubernetes. + +See [Using the Weave CNI Plugin](/site/plugin/cni-plugin-how-to.md) for more details. + + ###IP Address Management (IPAM) Containers are automatically allocated a unique IP address. To view the addresses allocated by Weave run, `weave ps`. diff --git a/site/plugin/cni-plugin-how-to.md b/site/plugin/cni-plugin-how-to.md new file mode 100644 index 00000000..e59ea070 --- /dev/null +++ b/site/plugin/cni-plugin-how-to.md @@ -0,0 +1,77 @@ +--- +title: Using the Weave Net CNI Plugin +layout: default +--- + +CNI, the [_Container Network Interface_](https://github.com/appc/cni#cni---the-container-network-interface), +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. + +###Installing the Weave Net CNI plugin + +The Weave Net CNI plugin is installed when you run `weave setup`, if +it your machine has the directories normally used to host CNI plugins. +To create those directories, run (as root): + + mkdir -p /opt/cni/bin + mkdir -p /etc/cni/net.d + +Then run: + + weave setup + +###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). + +See [Deploying Applications to Weave Net](/site/using-weave/deploying-applications.md#peer-connections) for a discussion on peer connections. + +As well as launching Weave Net, you have to run an extra command to +configure 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. + +###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 +file named `10-weave.conf`, which you can alter to suit your needs. + +See the [CNI Spec]](https://github.com/appc/cni/blob/master/SPEC.md#network-configuration) +for details on the format and contents of this file. + +By default, the Weave CNI plugin will add a default route out via the Weave bridge, so your containers can access resources on the internet. If you do not want this, add a section to the config file specifying no routes: + +``` + "ipam": { + "routes": [ ] + } +``` + +The following other fields in the spec are supported: + +- `ipam / type` - default is to use Weave's own IPAM +- `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`) + +###Caveats + +- The Weave router container must be running for CNI to allocate addresses +- The CNI plugin does not add entries to Weave DNS.