Merge branch '1.6'
This commit is contained in:
commit
8ec6b699b1
2 files changed
+48
-20
No files matched your search
+48
-19
@@ -1,13 +1,14 @@
|
|||||||
---
|
---
|
||||||
title: Integrating Kubernetes via the CNI Plugin
|
title: Integrating Kubernetes and Mesos via the CNI Plugin
|
||||||
menu_order: 65
|
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
|
is a proposed standard for configuring network interfaces for Linux
|
||||||
application containers. CNI is supported by
|
application containers. CNI is supported by
|
||||||
[Kubernetes](http://kubernetes.io/), an open source container cluster
|
[Kubernetes](http://kubernetes.io/), [Apache Mesos](mesos.apache.org)
|
||||||
manager built by Google.
|
and
|
||||||
|
[others](https://github.com/containernetworking/cni#who-is-using-cni).
|
||||||
|
|
||||||
###Installing the Weave Net CNI plugin
|
###Installing the Weave Net CNI plugin
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ Then run:
|
|||||||
|
|
||||||
weave setup
|
weave setup
|
||||||
|
|
||||||
###Launching Weave Net
|
####Launching Weave Net
|
||||||
|
|
||||||
To create a network that spans multiple hosts, the Weave peers must be connected to each other.
|
To create a network that spans multiple hosts, the Weave peers must be connected to each other.
|
||||||
This is accomplished by specifying the other hosts during `weave launch` or via
|
This is accomplished by specifying the other hosts during `weave launch` or via
|
||||||
@@ -39,20 +40,7 @@ which is required by Kubernetes, by running the following:
|
|||||||
|
|
||||||
weave expose
|
weave expose
|
||||||
|
|
||||||
###Configuring Kubernetes to use the CNI Plugin
|
####Using the CNI network configuration file
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
All CNI plugins are configured by a JSON file in the directory
|
All CNI plugins are configured by a JSON file in the directory
|
||||||
`/etc/cni/net.d/`. `weave setup` installs a minimal configuration
|
`/etc/cni/net.d/`. `weave setup` installs a minimal configuration
|
||||||
@@ -73,6 +61,47 @@ The following other fields in the spec are supported:
|
|||||||
- `ipam / subnet` - default is to use Weave's IPAM default subnet
|
- `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`)
|
- `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 </dev/null >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 <IP FROM LOGS> 1080
|
||||||
|
|
||||||
|
For more information, see the
|
||||||
|
[Mesos documentation](http://mesos.apache.org/documentation/cni/).
|
||||||
|
|
||||||
###Caveats
|
###Caveats
|
||||||
|
|
||||||
- The Weave Net router container must be running for CNI to allocate addresses
|
- The Weave Net router container must be running for CNI to allocate addresses
|
||||||
|
|||||||
Reference in new issue
Block a user