Skip to content

Commit

Permalink
Migrate docs to use new libnetworking UX
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Brockbank committed Oct 15, 2015
1 parent 26295bf commit 695b771
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 207 deletions.
2 changes: 1 addition & 1 deletion calico_containers/calico_ctl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.0.dev"
__version__ = "0.8.0.dev"
4 changes: 2 additions & 2 deletions docs/getting-started/default-networking/Demonstration.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You should see output like this on each node

vagrant@calico-01:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39de206f7499 calico/node:v0.7.0 "/sbin/my_init" 2 minutes ago Up 2 minutes calico-node
39de206f7499 calico/node:v0.8.0 "/sbin/my_init" 2 minutes ago Up 2 minutes calico-node

## Networking containers.

Expand Down Expand Up @@ -120,6 +120,6 @@ the host.

For example:

calicoctl node --ip=172.17.8.101 --ip6=fd80:24e2:f998:72d7::1 --libnetwork
calicoctl node --ip=172.17.8.101 --ip6=fd80:24e2:f998:72d7::1

See the [IPv6 demonstration](DemonstrationIPv6.md) for a worked example.
8 changes: 4 additions & 4 deletions docs/getting-started/default-networking/EnvironmentSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Get the calicoctl binary onto each host. You can download a specific
[release][calico-releases] from github.
For example, to retrieve the latest v0.7.0 release, on each host run

wget https://github.com/projectcalico/calico-docker/releases/download/v0.7.0/calicoctl
wget https://github.com/projectcalico/calico-docker/releases/download/v0.8.0/calicoctl
chmod +x calicoctl

This binary should be placed in your `$PATH` so it can be run from any
Expand All @@ -83,7 +83,7 @@ run `calicoctl node` the first time. Select the same version of the Calico
Docker image as you selected above. For example, to pull the latest released
version

docker pull calico/node:v0.7.0
docker pull calico/node:v0.8.0

## Final checks

Expand All @@ -94,9 +94,9 @@ Check that the hosts have IP addresses assigned, and that your hosts can ping
one another.

You should also verify each host can access etcd. The following will return
an error if etcd is not available.
the current etcd version if etcd is available.

etcdctl ls /
curl -L http://127.0.0.1:4001/version

[etcd]: https://coreos.com/etcd/docs/latest/
[calico-releases]: https://github.com/projectcalico/calico-docker/releases/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ write_files:
owner: root
content: |
#!/usr/bin/bash -e
wget -O /opt/bin/calicoctl https://github.com/projectcalico/calico-docker/releases/download/v0.7.0/calicoctl
wget -O /opt/bin/calicoctl https://github.com/projectcalico/calico-docker/releases/download/v0.8.0/calicoctl
chmod +x /opt/bin/calicoctl
/opt/bin/calicoctl checksystem --fix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ write_files:
owner: root
content: |
#!/usr/bin/bash -e
wget -O /opt/bin/calicoctl https://github.com/projectcalico/calico-docker/releases/download/v0.7.0/calicoctl
wget -O /opt/bin/calicoctl https://github.com/projectcalico/calico-docker/releases/download/v0.8.0/calicoctl
chmod +x /opt/bin/calicoctl
/opt/bin/calicoctl checksystem --fix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# image which slows down the install process, but speeds up the demonstration.
# This version should match the version of calicotl installed in the cloud
# config files.
calico_docker_ver = "v0.7.0"
calico_docker_ver = "v0.8.0"

# Size of the cluster created by Vagrant
num_instances=2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# vi: set ft=ruby :

# The version of calico to install
calico_docker_ver = "v0.7.0"
calico_docker_ver = "v0.8.0"

# Size of the cluster created by Vagrant
num_instances=2
Expand Down
94 changes: 61 additions & 33 deletions docs/getting-started/libnetwork/Demonstration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Calico as a libnetwork plugin.
This demonstration uses Docker's native [libnetwork network driver](https://github.com/docker/libnetwork), available in the Docker [experimental channel](https://github.com/docker/docker/tree/master/experimental) alongside the Docker 1.8 release. Docker's experimental channel is still moving fast and some of its features are not yet fully stable, so we recommend using a known, working version of the experimental docker binary from calico-docker release [0.5.3](https://github.com/projectcalico/calico-docker/releases/tag/v0.5.3) (July 21) or [0.5.4](https://github.com/projectcalico/calico-docker/releases/tag/v0.5.4) (August 5, optimized for 64-bit Ubuntu).
This demonstration uses Docker's native
[libnetwork network driver](https://github.com/docker/libnetwork), available
from Docker 1.9 release and above.

## Environment
This demonstration makes some assumptions about the environment you have. See
Expand Down Expand Up @@ -27,60 +29,86 @@ This will start a container on each host. Check they are running

You should see output like this on each node

vagrant@calico-01:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39de206f7499 calico/node-libnetwork "/sbin/my_init" 2 minutes ago Up 2 minutes calico-node

vagrant@calico-01:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eec9ebbfb486 calico/node-libnetwork:v0.4.0 "./start.sh" 21 seconds ago Up 19 seconds calico-libnetwork
ffe6cb403e9b calico/node:v0.8.0 "/sbin/my_init" 21 seconds ago Up 20 seconds calico-node

## Creating networked endpoints

The experimental channel version of Docker introduces a new flag to
`docker run` to network containers: `--publish-service <service>.<network>.<driver>`.
As of Docker 1.9, the integration of Docker with libnetwork introduces a new
mechanism to provide networking for Docker containers.

The new command `docker network` can be used to create a logical network.
A new flag is introduced to `docker run` to join a container to a particular
network: `--net <network>`.

* `<service>` is the name by which you want the container to be known on the network.
* `<network>` is the name of the network to join. Containers on different networks cannot communicate with each other.
* `<driver>` is the name of the network driver to use. Calico's driver is called `calico`.
So let's go ahead and create some networks and start a few containers
on each host spread between these networks.

So let's go ahead and start a few containers on each host.
On either host, create three networks:

docker network create --driver=calico --subnet=192.168.0.0/24 net1
docker network create --driver=calico --subnet=192.168.1.0/24 net2
docker network create --driver=calico --subnet=192.168.2.0/24 net3

Note that we use the Calico driver `calico`. This driver is run within
the calico-node container. We explicitly choose an IP Pool for each network
rather than using the default selections - this is to avoid potential conflicts
with the default NAT IP assignment used by VirtualBox. Depending on your
specific environment, you may need to choose different IP Pool CIDRs.

On calico-01

docker run --publish-service srvA.net1.calico --name workload-A -tid busybox
docker run --publish-service srvB.net2.calico --name workload-B -tid busybox
docker run --publish-service srvC.net1.calico --name workload-C -tid busybox
docker run --net net1 --name workload-A -tid busybox
docker run --net net2 --name workload-B -tid busybox
docker run --net net1 --name workload-C -tid busybox

On calico-02

docker run --publish-service srvD.net3.calico --name workload-D -tid busybox
docker run --publish-service srvE.net1.calico --name workload-E -tid busybox
docker run --net net3 --name workload-D -tid busybox
docker run --net net1 --name workload-E -tid busybox

By default, networks are configured so that their members can communicate with
one another, but workloads in other networks cannot reach them. A, C and E are
all in the same network so should be able to ping each other. B and D are in
their own networks so shouldn't be able to ping anyone else.
all in the same network so should be able to ping each other. B and D are in
their own networks so shouldn't be able to ping anyone else.

On calico-01 check that A can ping C and E.
On calico-01 check that A can ping C and E. You can use either the IP address
or the name for containers within the same network.

docker exec workload-A ping -c 4 srvC
docker exec workload-A ping -c 4 srvE
docker exec workload-A ping -c 4 `docker inspect --format "{{ .NetworkSettings.IPAddress }}" workload-C`
docker exec workload-A ping -c 4 workload-E.net1

Also check that A cannot ping B or D
Also check that A cannot ping B or D. This is slightly trickier because the
hostnames for different networks will not be added to the host configuration of
the container - so we need to determine the IP addresses assigned to containers
B and D.

docker exec workload-A ping -c 4 srvB
docker exec workload-A ping -c 4 srvD
On calico-01 run

To see the list of networks, use
docker inspect --format "{{ .NetworkSettings.IPAddress }}" workload-B

this returns the IP address of workload-B.

On calico-02 run

docker network ls
docker inspect --format "{{ .NetworkSettings.IPAddress }}" workload-D

This returns the IP address of workload-D.

## IPv6 (Optional)
On calico-01 run

IPv6 networking is also supported. If you are using IPv6 address spaces as
well, start your Calico node passing in both the IPv4 and IPv6 addresses of
the host.
docker exec workload-A ping -c 4 <IP address of B>
docker exec workload-A ping -c 4 <IP address of D>

For example:
replacing the `<...>` with the appropriate IP address for B and D. These pings
will fail.

To see the list of networks, use

calicoctl node --ip=172.17.8.101 --ip6=fd80:24e2:f998:72d7::1 --libnetwork
docker network ls

## IPv6 (Optional)

See the [IPv6 demonstration](DemonstrationIPv6.md) for a worked example.
IPv6 networking is not yet supported for Calico networking with libnetwork.
63 changes: 0 additions & 63 deletions docs/getting-started/libnetwork/DemonstrationIPv6.md

This file was deleted.

47 changes: 14 additions & 33 deletions docs/getting-started/libnetwork/EnvironmentSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ The servers also need:
- A specific Docker release to be running - since the Calico agent is packaged
as a Docker container, and the libnetwork features required are currently
only available in an experimental release.
- A consul server used for clustering Docker.
- A consul server used for clustering Docker
- An Etcd cluster - which Calico uses for coordinating state between the nodes.
- The `calicoctl` to be placed in the `$PATH`.
- The `calicoctl` binary to be placed in the system `$PATH`.

## Requirements

Expand All @@ -50,35 +50,16 @@ We recommend configuring the hosts with the hostname `calico-01` and
`calico-02`. The demonstration will refer to these hostnames.

They must have the following software installed:
- The experimental release of [Docker](#experimental-docker)
- [Docker 1.9 or greater](#Docker)
- etcd installed and available on each node: [etcd documentation][etcd]
- `ipset`, `iptables`, and `ip6tables` kernel modules.
- A [consul server](#consul) running on calico-01

### Consul
### Docker

To install consul, download and unzip the consul binary and give it executable
permissions. For example:

wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip -O consul.zip
unzip -o consul.zip
rm consul.zip
chmod +x consul

You can start consul using the following:

./consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul -client <IPV4>

where <IPV4> is replaced with your appropriate IPv4 address. This address
should be accessible by both servers.

### Experimental Docker

Follow the instructions for installing the
[experimental channel of Docker][experimental-docker-git].
Follow the instructions for installing
[Docker][docker].

Docker's experimental channel is still moving fast and some of its
features are not yet fully stable.
A version of 1.9 or greater is required.

### Docker permissions

Expand All @@ -98,7 +79,7 @@ Get the calicoctl binary onto each host. You can download a specific
[release][calico-releases] from github.
For example, to retrieve the latest v0.7.0 release, on each host run

wget https://github.com/projectcalico/calico-docker/releases/download/v0.7.0/calicoctl
wget https://github.com/projectcalico/calico-docker/releases/download/v0.8.0/calicoctl
chmod +x calicoctl

This binary should be placed in your `$PATH` so it can be run from any
Expand All @@ -110,7 +91,7 @@ You can optionally preload this image to avoid the delay when you run
`calicoctl node --libnetwork` the first time. For example, to pull the latest
released version, run

docker pull calico/node-libnetwork:v0.3.0
docker pull calico/node-libnetwork:v0.4.0

## Final checks

Expand All @@ -120,17 +101,17 @@ you'll need to adjust the demonstration instructions accordingly.
Check that the hosts have IP addresses assigned, and that your hosts can ping
one another.

Check that you are running with the experimental version of Docker.
Check that you are running with a suitable version of Docker.

docker version

It should indicate a version of 1.8.0 and experimental.
It should indicate a version of 1.9 or greater.

You should also verify each host can access etcd. The following will return
an error if etcd is not available.
the current etcd version if etcd is available.

etcdctl ls /
curl -L http://127.0.0.1:4001/version

[etcd]: https://coreos.com/etcd/docs/latest/
[calico-releases]: https://github.com/projectcalico/calico-docker/releases/
[experimental-docker-git]: https://github.com/docker/docker/tree/master/experimental
[docker]: https://docs.docker.com/installation/

0 comments on commit 695b771

Please sign in to comment.