forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from squeed/merge-docs
Documentation folder merge
- Loading branch information
Showing
9 changed files
with
405 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
# plugins | ||
Some additional CNI network plugins, matinained by the containernetworking team | ||
Some CNI network plugins, maintained by the containernetworking team. For more information, see the individual READMEs. | ||
|
||
## Plugins supplied: | ||
### Main: interface-creating | ||
* `bridge`: Creates a bridge, adds the host and the container to it. | ||
* `ipvlan`: Adds an [ipvlan](https://www.kernel.org/doc/Documentation/networking/ipvlan.txt) interface in the container | ||
* `loopback`: Creates a loopback interface | ||
* `macvlan`: Creates a new MAC address, forwards all traffic to that to the container | ||
* `ptp`: Creates a veth pair. | ||
* `vlan`: Allocates a vlan device. | ||
|
||
### IPAM: IP address allocation | ||
* `dhcp`: Runs a daemon on the host to make DHCP requests on behalf of the container | ||
* `host-local`: maintains a local database of allocated IPs | ||
|
||
### Meta: other plugins | ||
* `flannel`: generates an interface corresponding to a flannel config file | ||
* `tuning`: Tweaks sysctl parameters of an existing interface | ||
|
||
|
||
### Sample | ||
The sample plugin provides a base for building a sample plugin with tests. | ||
The sample plugin provides an example for building your own plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# dhcp plugin | ||
|
||
## Overview | ||
|
||
With dhcp plugin the containers can get an IP allocated by a DHCP server already running on your network. | ||
This can be especially useful with plugin types such as [macvlan](../../main/macvlan/README.md). | ||
Because a DHCP lease must be periodically renewed for the duration of container lifetime, a separate daemon is required to be running. | ||
The same plugin binary can also be run in the daemon mode. | ||
|
||
## Operation | ||
To use the dhcp IPAM plugin, first launch the dhcp daemon: | ||
|
||
``` | ||
# Make sure the unix socket has been removed | ||
$ rm -f /run/cni/dhcp.sock | ||
$ ./dhcp daemon | ||
``` | ||
|
||
Alternatively, you can use systemd socket activation protocol. | ||
Be sure that the .socket file uses /run/cni/dhcp.sock as the socket path. | ||
|
||
With the daemon running, containers using the dhcp plugin can be launched. | ||
|
||
## Example configuration | ||
|
||
``` | ||
{ | ||
"ipam": { | ||
"type": "dhcp", | ||
} | ||
} | ||
## Network configuration reference | ||
* `type` (string, required): "dhcp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# host-local IP address management plugin | ||
|
||
host-local IPAM allocates IPv4 and IPv6 addresses out of a specified address range. Optionally, | ||
it can include a DNS configuration from a `resolv.conf` file on the host. | ||
|
||
## Overview | ||
|
||
host-local IPAM plugin allocates IPv4 addresses out of a specified address range. | ||
It stores the state locally on the host filesystem, therefore ensuring uniqueness of IP addresses on a single host. | ||
|
||
## Example configurations | ||
|
||
IPv4: | ||
```json | ||
{ | ||
"ipam": { | ||
"type": "host-local", | ||
"subnet": "10.10.0.0/16", | ||
"rangeStart": "10.10.1.20", | ||
"rangeEnd": "10.10.3.50", | ||
"gateway": "10.10.0.254", | ||
"routes": [ | ||
{ "dst": "0.0.0.0/0" }, | ||
{ "dst": "192.168.0.0/16", "gw": "10.10.5.1" } | ||
], | ||
"dataDir": "/var/my-orchestrator/container-ipam-state" | ||
} | ||
} | ||
``` | ||
|
||
IPv6: | ||
```json | ||
{ | ||
"ipam": { | ||
"type": "host-local", | ||
"subnet": "3ffe:ffff:0:01ff::/64", | ||
"rangeStart": "3ffe:ffff:0:01ff::0010", | ||
"rangeEnd": "3ffe:ffff:0:01ff::0020", | ||
"routes": [ | ||
{ "dst": "3ffe:ffff:0:01ff::1/64" } | ||
], | ||
"resolvConf": "/etc/resolv.conf" | ||
} | ||
} | ||
``` | ||
|
||
We can test it out on the command-line: | ||
|
||
```bash | ||
$ export CNI_COMMAND=ADD | ||
$ export CNI_CONTAINERID=f81d4fae-7dec-11d0-a765-00a0c91e6bf6 | ||
$ echo '{ "name": "default", "ipam": { "type": "host-local", "subnet": "203.0.113.0/24" } }' | ./host-local | ||
``` | ||
|
||
```json | ||
{ | ||
"ip4": { | ||
"ip": "203.0.113.1/24" | ||
} | ||
} | ||
``` | ||
|
||
## Network configuration reference | ||
|
||
* `type` (string, required): "host-local". | ||
* `subnet` (string, required): CIDR block to allocate out of. | ||
* `rangeStart` (string, optional): IP inside of "subnet" from which to start allocating addresses. Defaults to ".2" IP inside of the "subnet" block. | ||
* `rangeEnd` (string, optional): IP inside of "subnet" with which to end allocating addresses. Defaults to ".254" IP inside of the "subnet" block. | ||
* `gateway` (string, optional): IP inside of "subnet" to designate as the gateway. Defaults to ".1" IP inside of the "subnet" block. | ||
* `routes` (string, optional): list of routes to add to the container namespace. Each route is a dictionary with "dst" and optional "gw" fields. If "gw" is omitted, value of "gateway" will be used. | ||
* `resolvConf` (string, optional): Path to a `resolv.conf` on the host to parse and return as the DNS configuration | ||
* `dataDir` (string, optional): Path to a directory to use for maintaining state, e.g. which IPs have been allocated to which containers | ||
|
||
|
||
## Supported arguments | ||
The following [CNI_ARGS](/~https://github.com/containernetworking/cni/blob/master/SPEC.md#parameters) are supported: | ||
|
||
* `ip`: request a specific IP address from the subnet. If it's not available, the plugin will exit with an error | ||
|
||
## Files | ||
|
||
Allocated IP addresses are stored as files in `/var/lib/cni/networks/$NETWORK_NAME`. The prefix can be customized with the `dataDir` option listed above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# bridge plugin | ||
|
||
## Overview | ||
|
||
With bridge plugin, all containers (on the same host) are plugged into a bridge (virtual switch) that resides in the host network namespace. | ||
The containers receive one end of the veth pair with the other end connected to the bridge. | ||
An IP address is only assigned to one end of the veth pair -- one residing in the container. | ||
The bridge itself can also be assigned an IP address, turning it into a gateway for the containers. | ||
Alternatively, the bridge can function purely in L2 mode and would need to be bridged to the host network interface (if other than container-to-container communication on the same host is desired). | ||
|
||
The network configuration specifies the name of the bridge to be used. | ||
If the bridge is missing, the plugin will create one on first use and, if gateway mode is used, assign it an IP that was returned by IPAM plugin via the gateway field. | ||
|
||
## Example configuration | ||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "bridge", | ||
"bridge": "mynet0", | ||
"isDefaultGateway": true, | ||
"forceAddress": false, | ||
"ipMasq": true, | ||
"hairpinMode": true, | ||
"ipam": { | ||
"type": "host-local", | ||
"subnet": "10.10.0.0/16" | ||
} | ||
} | ||
``` | ||
|
||
## Network configuration reference | ||
|
||
* `name` (string, required): the name of the network. | ||
* `type` (string, required): "bridge". | ||
* `bridge` (string, optional): name of the bridge to use/create. Defaults to "cni0". | ||
* `isGateway` (boolean, optional): assign an IP address to the bridge. Defaults to false. | ||
* `isDefaultGateway` (boolean, optional): Sets isGateway to true and makes the assigned IP the default route. Defaults to false. | ||
* `forceAddress` (boolean, optional): Indicates if a new IP address should be set if the previous value has been changed. Defaults to false. | ||
* `ipMasq` (boolean, optional): set up IP Masquerade on the host for traffic originating from this network and destined outside of it. Defaults to false. | ||
* `mtu` (integer, optional): explicitly set MTU to the specified value. Defaults to the value chosen by the kernel. | ||
* `hairpinMode` (boolean, optional): set hairpin mode for interfaces on the bridge. Defaults to false. | ||
* `ipam` (dictionary, required): IPAM configuration to be used for this network. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# ipvlan plugin | ||
|
||
## Overview | ||
|
||
ipvlan is a new [addition](https://lwn.net/Articles/620087/) to the Linux kernel. | ||
Like its cousin macvlan, it virtualizes the host interface. | ||
However unlike macvlan which generates a new MAC address for each interface, ipvlan devices all share the same MAC. | ||
The kernel driver inspects the IP address of each packet when making a decision about which virtual interface should process the packet. | ||
|
||
Because all ipvlan interfaces share the MAC address with the host interface, DHCP can only be used in conjunction with ClientID (currently not supported by DHCP plugin). | ||
|
||
## Example configuration | ||
|
||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "ipvlan", | ||
"master": "eth0", | ||
"ipam": { | ||
"type": "host-local", | ||
"subnet": "10.1.2.0/24" | ||
} | ||
} | ||
``` | ||
|
||
## Network configuration reference | ||
|
||
* `name` (string, required): the name of the network. | ||
* `type` (string, required): "ipvlan". | ||
* `master` (string, required): name of the host interface to enslave. | ||
* `mode` (string, optional): one of "l2", "l3". Defaults to "l2". | ||
* `mtu` (integer, optional): explicitly set MTU to the specified value. Defaults to the value chosen by the kernel. | ||
* `ipam` (dictionary, required): IPAM configuration to be used for this network. | ||
|
||
## Notes | ||
|
||
* `ipvlan` does not allow virtual interfaces to communicate with the master interface. | ||
Therefore the container will not be able to reach the host via `ipvlan` interface. | ||
Be sure to also have container join a network that provides connectivity to the host (e.g. `ptp`). | ||
* A single master interface can not be enslaved by both `macvlan` and `ipvlan`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# macvlan plugin | ||
|
||
## Overview | ||
|
||
[macvlan](http://backreference.org/2014/03/20/some-notes-on-macvlanmacvtap/) functions like a switch that is already connected to the host interface. | ||
A host interface gets "enslaved" with the virtual interfaces sharing the physical device but having distinct MAC addresses. | ||
Since each macvlan interface has its own MAC address, it makes it easy to use with existing DHCP servers already present on the network. | ||
|
||
## Example configuration | ||
|
||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "macvlan", | ||
"master": "eth0", | ||
"ipam": { | ||
"type": "dhcp" | ||
} | ||
} | ||
``` | ||
|
||
## Network configuration reference | ||
|
||
* `name` (string, required): the name of the network | ||
* `type` (string, required): "macvlan" | ||
* `master` (string, required): name of the host interface to enslave | ||
* `mode` (string, optional): one of "bridge", "private", "vepa", "passthrough". Defaults to "bridge". | ||
* `mtu` (integer, optional): explicitly set MTU to the specified value. Defaults to the value chosen by the kernel. | ||
* `ipam` (dictionary, required): IPAM configuration to be used for this network. | ||
|
||
## Notes | ||
|
||
* If are testing on a laptop, please remember that most wireless cards do not support being enslaved by macvlan. | ||
* A single master interface can not be enslaved by both `macvlan` and `ipvlan`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# ptp plugin | ||
|
||
## Overview | ||
The ptp plugin creates a point-to-point link between a container and the host by using a veth device. | ||
One end of the veth pair is placed inside a container and the other end resides on the host. | ||
The host-local IPAM plugin can be used to allocate an IP address to the container. | ||
The traffic of the container interface will be routed through the interface of the host. | ||
|
||
## Example network configuration | ||
|
||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "ptp", | ||
"ipam": { | ||
"type": "host-local", | ||
"subnet": "10.1.1.0/24" | ||
}, | ||
"dns": { | ||
"nameservers": [ "10.1.1.1", "8.8.8.8" ] | ||
} | ||
} | ||
``` | ||
|
||
## Network configuration reference | ||
|
||
* `name` (string, required): the name of the network | ||
* `type` (string, required): "ptp" | ||
* `ipMasq` (boolean, optional): set up IP Masquerade on the host for traffic originating from this network and destined outside of it. Defaults to false. | ||
* `mtu` (integer, optional): explicitly set MTU to the specified value. Defaults to value chosen by the kernel. | ||
* `ipam` (dictionary, required): IPAM configuration to be used for this network. | ||
* `dns` (dictionary, optional): DNS information to return as described in the [Result](/~https://github.com/containernetworking/cni/blob/master/SPEC.md#result). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# flannel plugin | ||
|
||
## Overview | ||
This plugin is designed to work in conjunction with [flannel](/~https://github.com/coreos/flannel), a network fabric for containers. | ||
When flannel daemon is started, it outputs a `/run/flannel/subnet.env` file that looks like this: | ||
``` | ||
FLANNEL_NETWORK=10.1.0.0/16 | ||
FLANNEL_SUBNET=10.1.17.1/24 | ||
FLANNEL_MTU=1472 | ||
FLANNEL_IPMASQ=true | ||
``` | ||
|
||
This information reflects the attributes of flannel network on the host. | ||
The flannel CNI plugin uses this information to configure another CNI plugin, such as bridge plugin. | ||
|
||
## Operation | ||
Given the following network configuration file and the contents of `/run/flannel/subnet.env` above, | ||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "flannel" | ||
} | ||
``` | ||
the flannel plugin will generate another network configuration file: | ||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "bridge", | ||
"mtu": 1472, | ||
"ipMasq": false, | ||
"isGateway": true, | ||
"ipam": { | ||
"type": "host-local", | ||
"subnet": "10.1.17.0/24" | ||
} | ||
} | ||
``` | ||
|
||
It will then invoke the bridge plugin, passing it the generated configuration. | ||
|
||
As can be seen from above, the flannel plugin, by default, will delegate to the bridge plugin. | ||
If additional configuration values need to be passed to the bridge plugin, it can be done so via the `delegate` field: | ||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "flannel", | ||
"delegate": { | ||
"bridge": "mynet0", | ||
"mtu": 1400 | ||
} | ||
} | ||
``` | ||
|
||
This supplies a configuration parameter to the bridge plugin -- the created bridge will now be named `mynet0`. | ||
Notice that `mtu` has also been specified and this value will not be overwritten by flannel plugin. | ||
|
||
Additionally, the `delegate` field can be used to select a different kind of plugin altogether. | ||
To use `ipvlan` instead of `bridge`, the following configuration can be specified: | ||
|
||
``` | ||
{ | ||
"name": "mynet", | ||
"type": "flannel", | ||
"delegate": { | ||
"type": "ipvlan", | ||
"master": "eth0" | ||
} | ||
} | ||
``` | ||
|
||
## Network configuration reference | ||
|
||
* `name` (string, required): the name of the network | ||
* `type` (string, required): "flannel" | ||
* `subnetFile` (string, optional): full path to the subnet file written out by flanneld. Defaults to /run/flannel/subnet.env | ||
* `dataDir` (string, optional): path to directory where plugin will store generated network configuration files. Defaults to `/var/lib/cni/flannel` | ||
* `delegate` (dictionary, optional): specifies configuration options for the delegated plugin. | ||
|
||
flannel plugin will always set the following fields in the delegated plugin configuration: | ||
|
||
* `name`: value of its "name" field. | ||
* `ipam`: "host-local" type will be used with "subnet" set to `$FLANNEL_SUBNET`. | ||
|
||
flannel plugin will set the following fields in the delegated plugin configuration if they are not present: | ||
* `ipMasq`: the inverse of `$FLANNEL_IPMASQ` | ||
* `mtu`: `$FLANNEL_MTU` | ||
|
||
Additionally, for the bridge plugin, `isGateway` will be set to `true`, if not present. |
Oops, something went wrong.