added manage sd and mv using-weave to it
This commit is contained in:
1 parent
e41b5d9a1c
commit
9d0a0253c9
13 files changed
No files matched your search
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Allocating IPs in a Specific Range
|
||||
menu_order: 15
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
The default configurations for both Weave Net and Docker use [Private
|
||||
Networks](https://en.wikipedia.org/wiki/Private_network), whose
|
||||
addresses are never found on the public Internet, and subsequently reduces the
|
||||
chance of IP overlap. However, it could be that you or your hosting provider
|
||||
are using some of these private addresses in the same range, which will
|
||||
cause a clash.
|
||||
|
||||
If after `weave launch`, the following error message
|
||||
appears:
|
||||
|
||||
Network 10.32.0.0/12 overlaps with existing route 10.0.0.0/8 on host.
|
||||
ERROR: Default --ipalloc-range 10.32.0.0/12 overlaps with existing route on host.
|
||||
You must pick another range and set it on all hosts.
|
||||
|
||||
As the message indicates, the default range that Weave Net would like to use is
|
||||
`10.32.0.0/12` - a 12-bit prefix, where all addresses start with the bit
|
||||
pattern 000010100010, or in decimal everything from 10.32.0.0 through
|
||||
10.47.255.255.
|
||||
|
||||
However, your host is using a route for `10.0.0.0/8`,
|
||||
which overlaps, since the first 8 bits are the same. In this case, if you used the default network
|
||||
for an address like `10.32.5.6` the kernel would never be sure if this meant the
|
||||
Weave Net network of `10.32.0.0/12` or the hosting network of
|
||||
`10.0.0.0/8`.
|
||||
|
||||
If you are sure the addresses you want are not in use, then
|
||||
explicitly setting the range with `--ipalloc-range` in the
|
||||
command-line arguments to `weave launch` on all hosts forces Weave
|
||||
Net to use that range, even though it overlaps. Otherwise, you can
|
||||
pick a different range, preferably another subset of the [Private
|
||||
Networks](https://en.wikipedia.org/wiki/Private_network). For example
|
||||
172.30.0.0/16.
|
||||
|
||||
|
||||
**See Also**
|
||||
|
||||
* [IP Addresses, Routes and Networks](/site/how-it-works/ip-addresses.md)
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: Isolating Applications on a Weave Network
|
||||
menu_order: 30
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
A single Weave network can host multiple, isolated applications where each application's containers are able
|
||||
to communicate with each other, but not with the containers of other applications.
|
||||
|
||||
To isolate applications, you can make use of `isolation-through-subnets` technique.
|
||||
This common strategy is an example of how with Weave Net many of your `on metal`
|
||||
techniques can still be used to deploy applications to a container network.
|
||||
|
||||
To begin isolating an application (or parts of an application),
|
||||
configure Weave Net's IP allocator to manage multiple subnets.
|
||||
|
||||
Using [the netcat example](/site/using-weave.md), configure multiple subsets:
|
||||
|
||||
host1$ weave launch --ipalloc-range 10.2.0.0/16 --ipalloc-default-subnet 10.2.1.0/24
|
||||
host1$ eval $(weave env)
|
||||
host2$ weave launch --ipalloc-range 10.2.0.0/16 --ipalloc-default-subnet 10.2.1.0/24 $HOST1
|
||||
host2$ eval $(weave env)
|
||||
|
||||
This delegates the entire 10.2.0.0/16 subnet to Weave Net, and instructs
|
||||
it to allocate from 10.2.1.0/24 within that, if a specific subnet is not
|
||||
specified.
|
||||
|
||||
Next, launch the two netcat containers onto the default subnet:
|
||||
|
||||
host1$ docker run --name a1 -ti weaveworks/ubuntu
|
||||
host2$ docker run --name a2 -ti weaveworks/ubuntu
|
||||
|
||||
And then to test the isolation, launch a few more containers onto a different subnet:
|
||||
|
||||
host1$ docker run -e WEAVE_CIDR=net:10.2.2.0/24 --name b1 -ti weaveworks/ubuntu
|
||||
host2$ docker run -e WEAVE_CIDR=net:10.2.2.0/24 --name b2 -ti weaveworks/ubuntu
|
||||
|
||||
Ping each container to confirm that they can talk to each other, but not to the containers of our first subnet:
|
||||
|
||||
root@b1:/# ping -c 1 -q b2
|
||||
PING b2.weave.local (10.2.2.128) 56(84) bytes of data.
|
||||
--- b2.weave.local ping statistics ---
|
||||
1 packets transmitted, 1 received, 0% packet loss, time 0ms
|
||||
rtt min/avg/max/mdev = 1.338/1.338/1.338/0.000 ms
|
||||
|
||||
root@b1:/# ping -c 1 -q a1
|
||||
PING a1.weave.local (10.2.1.2) 56(84) bytes of data.
|
||||
--- a1.weave.local ping statistics ---
|
||||
1 packets transmitted, 0 received, 100% packet loss, time 0ms
|
||||
|
||||
root@b1:/# ping -c 1 -q a2
|
||||
PING a2.weave.local (10.2.1.130) 56(84) bytes of data.
|
||||
--- a2.weave.local ping statistics ---
|
||||
1 packets transmitted, 0 received, 100% packet loss, time 0ms
|
||||
|
||||
If required, a container can also be attached to multiple subnets when it is started using:
|
||||
|
||||
host1$ docker run -e WEAVE_CIDR="net:default net:10.2.2.0/24" -ti weaveworks/ubuntu
|
||||
|
||||
`net:default` is used to request the allocation of an address from the default subnet in addition to one from an explicitly specified range.
|
||||
|
||||
>**Important:** Containers must be prevented from capturing and injecting raw network packets - this can be accomplished by starting them with the `--cap-drop net_raw` option.
|
||||
|
||||
>Note: By default docker permits communication between containers on the same host, via their docker-assigned IP addresses. For complete
|
||||
isolation between application containers, that feature needs to be disabled by [setting `--icc=false`](https://docs.docker.com/engine/userguide/networking/default_network/container-communication/#communication-between-containers) in the docker daemon configuration.
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Automatic Allocation Across Multiple Subnets](/site/ipam/allocation-multi-ipam.md)
|
||||
* [Managing Services - Exporting, Importing, Binding and Routing](/site/using-weave/service-management.md)
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
title: Using IP Routing on an Amazon Web Services Virtual Private Cloud
|
||||
menu_order: 110
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
If your container infrastructure is running entirely within Amazon Web Services (AWS)
|
||||
Elastic Compute Cloud (EC2), then you can enable AWS-VPC mode with Weave Net. In AWS-VPC mode,
|
||||
containers are networked without using an overlay and allows network speeds
|
||||
close to that of the underlying network.
|
||||
|
||||
With AWS-VPC enabled, Weave Net manages IP addresses and connects
|
||||
containers to the network as usual, but instead of wrapping each packet and
|
||||
sending it to its destination, Weave Net instructs the AWS network
|
||||
router with the ranges of container IP addresses and the instances
|
||||
on which they live.
|
||||
|
||||

|
||||
|
||||
### Configuring EC2 Instances to use Weave AWS-VPC Mode
|
||||
|
||||
First, your AWS instances need to be given write access to the route
|
||||
table via its
|
||||
[IAM Role](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html).
|
||||
If you have an existing IAM Role then extend it, otherwise create a
|
||||
new role. The role must have a
|
||||
[policy](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-policies-for-amazon-ec2.html)
|
||||
attached which allows the following
|
||||
[actions](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Operations.html):
|
||||
|
||||
|
||||
```
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"ec2:CreateRoute",
|
||||
"ec2:DeleteRoute",
|
||||
"ec2:ReplaceRoute",
|
||||
"ec2:DescribeRouteTables",
|
||||
"ec2:DescribeInstances"
|
||||
],
|
||||
"Resource": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Secondly, your Security Group must allow network traffic between instances.
|
||||
You must open TCP port 6783 which is the port that Weave Net uses to manage the network and also
|
||||
allow any ports which your own containers use.
|
||||
|
||||
>>**Remember:** There is no network overlay in this mode, and so, IP packets with container
|
||||
addresses will flow over the AWS network unmodified.
|
||||
|
||||
Finally, since Weave will be operating with IP addresses outside of the
|
||||
range allocated by Amazon, you must disable "Source/Destination check" on each machine.
|
||||
|
||||
### Using AWS-VPC Mode
|
||||
|
||||
Launch Weave Net with the `--awsvpc` flag:
|
||||
|
||||
$ weave launch --awsvpc [other hosts]
|
||||
|
||||
>>**Note:** You will still need to supply the names or IP addresses of other hosts in
|
||||
your cluster.
|
||||
|
||||
### Present Limitations
|
||||
|
||||
- AWS-VPC mode does not inter-operate with other Weave Net modes; it
|
||||
is all or nothing. In this mode, all hosts in a cluster must be AWS
|
||||
instances. (We hope to ease this limitation in future.)
|
||||
- The `weave launch` command waits until the
|
||||
[IP address manager](/site//operational-guide/concepts.md#ip-address-manager-ipam)
|
||||
is ready, i.e. until after this peer has been able to make contact
|
||||
with other peers and confirm that it has joined the cluster the
|
||||
bridge. Without AWS-VPC, `weave launch` returns without waiting.
|
||||
- The AWS network does not support multicast.
|
||||
- The number of hosts in a cluster is limited by the maximum size of
|
||||
your AWS route table. This is limited to 50 entries though you
|
||||
can request an increase to 100 by contacting Amazon.
|
||||
- All of your containers must be on the same network, with no subnet
|
||||
isolation. (We hope to ease this limitation in future.)
|
||||
|
||||
### Packet size (MTU)
|
||||
|
||||
The Maximum Transmission Unit, or MTU, is the technical term for the
|
||||
limit on how big a single packet can be on the network. Weave Net
|
||||
defaults to 1376 bytes. This default works across almost all networks, but for better
|
||||
performance you can set it to a larger MTU size.
|
||||
|
||||
The AWS network supports packets of up to 9000 bytes.
|
||||
|
||||
In AWS-VPC mode you can run the following:
|
||||
|
||||
$ WEAVE_MTU=9000 weave launch --awsvpc host2 host3
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Using Weave Net](/site/using-weave.md)
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
title: Dynamically Attaching and Detaching Applications
|
||||
menu_order: 40
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
|
||||
When containers may not know the network to which they will be attached, Weave Net enables you to dynamically attach and detach containers to and from a given network, even when a container is already running.
|
||||
|
||||
To illustrate...
|
||||
|
||||
host1$ C=$(docker run -e WEAVE_CIDR=none -dti weaveworks/ubuntu)
|
||||
host1$ weave attach $C
|
||||
10.2.1.3
|
||||
|
||||
where,
|
||||
|
||||
* `C=$(docker run -e WEAVE_CIDR=none -dti weaveworks/ubuntu)` starts a container and assigns its ID to a variable
|
||||
* `weave attach` – the Weave Net command to attach to the specified container
|
||||
* `10.2.1.3` - the allocated IP address output by `weave attach`, in this case in the default subnet
|
||||
|
||||
>Note If you are using the Weave Docker API proxy, it will have modified `DOCKER_HOST` to point to the proxy and therefore you will have to pass `-e WEAVE_CIDR=none` to start a container that _doesn't_ get automatically attached to the weave network for the purposes of this example.
|
||||
|
||||
If `weave attach` sees the container has a hostname with a
|
||||
domain-name, it will add those into WeaveDNS (unless you turn this off
|
||||
with the `--without-dns` argument).
|
||||
|
||||
host1$ docker run -dti --name=c1 --hostname=c1.weave.local weaveworks/ubuntu
|
||||
host1$ weave attach c1
|
||||
10.32.0.1
|
||||
host1$ weave dns-lookup c1
|
||||
10.32.0.1
|
||||
|
||||
If you would like `/etc/hosts` to contain the Weave Net address (the
|
||||
same way [the proxy does](/site/weave-docker-api/name-resolution-proxy.md)),
|
||||
specify `--rewrite-hosts` when running `weave attach`:
|
||||
|
||||
host1$ weave attach --rewrite-hosts c1
|
||||
|
||||
### Dynamically Detaching Containers
|
||||
|
||||
A container can be detached from a subnet, by using the `weave detach` command:
|
||||
|
||||
host1$ weave detach $C
|
||||
10.2.1.3
|
||||
|
||||
You can also detach a container from one network and then attach it to a different one:
|
||||
|
||||
host1$ weave detach net:default $C
|
||||
10.2.1.3
|
||||
host1$ weave attach net:10.2.2.0/24 $C
|
||||
10.2.2.3
|
||||
|
||||
or, attach a container to multiple application networks, effectively sharing the same container between applications:
|
||||
|
||||
host1$ weave attach net:default
|
||||
10.2.1.3
|
||||
host1$ weave attach net:10.2.2.0/24
|
||||
10.2.2.3
|
||||
|
||||
Finally, multiple addresses can be attached or detached using a single command:
|
||||
|
||||
host1$ weave attach net:default net:10.2.2.0/24 net:10.2.3.0/24 $C
|
||||
10.2.1.3 10.2.2.3 10.2.3.1
|
||||
host1$ weave detach net:default net:10.2.2.0/24 net:10.2.3.0/24 $C
|
||||
10.2.1.3 10.2.2.3 10.2.3.1
|
||||
|
||||
>**Important!** Any addresses that were dynamically attached will not be re-attached if the container restarts.
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Adding and Removing Hosts Dynamically](/site/using-weave/finding-adding-hosts-dynamically.md)
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: Using Fast Datapath
|
||||
menu_order: 96
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
|
||||
The most important thing to know about fast datapath is that you don't need to configure anything before using this feature. If you are using Weave Net 1.2 or greater, fast datapath (`fastdp`) is automatically enabled.
|
||||
|
||||
When Weave Net cannot use the fast data path between two hosts, it falls back to a slower packet forwarding approach called `sleeve`. Selecting the fastest forwarding approach is automatic, and is determined on a connection-by-connection basis. For example, a Weave network spanning two data centers might use fast data path within the data centers, but not for the more constrained network link between them.
|
||||
|
||||
See [How Fastdp Works](/site/how-it-works/fastdp-how-it-works.md) for a more in-depth discussion of this feature.
|
||||
|
||||
### Disabling Fast Datapath
|
||||
|
||||
You can disable fastdp by enabling the `WEAVE_NO_FASTDP` environment variable at `weave launch`:
|
||||
|
||||
$ WEAVE_NO_FASTDP=true weave launch
|
||||
|
||||
### Fast Datapath and Encryption
|
||||
|
||||
Fast datapath implements encryption using IPsec which is configured with IP
|
||||
transformation framework (XFRM) provided by the Linux kernel.
|
||||
|
||||
Each encrypted dataplane packet is encapsulated into [ESP](https://tools.ietf.org/html/rfc2406),
|
||||
thus in some networks a firewall rule for allowing ESP traffic needs to be installed. E.g. Google
|
||||
Cloud Platform denies ESP packets by default.
|
||||
|
||||
See [How Weave Implements Encryption](/site/how-it-works/encryption-implementation.md)
|
||||
for more details for the fastdp encryption.
|
||||
|
||||
### Viewing Connection Mode Fastdp or Sleeve
|
||||
|
||||
Weave Net automatically uses the fastest datapath for every connection unless it encounters a situation that prevents it from working. To ensure that Weave Net can use the fast datapath:
|
||||
|
||||
* Avoid Network Address Translation (NAT) devices
|
||||
* Open UDP port 6784 (This is the port used by the Weave routers)
|
||||
* Ensure that `WEAVE_MTU` fits with the `MTU` of the intermediate network (see below)
|
||||
|
||||
The use of fast datapath is an automated connection-by-connection decision made by Weave Net, and because of this, you may end up with a mixture of connection tunnel types. If fast datapath cannot be used for a connection, Weave Net falls back to the `sleeve` "user space" packet path.
|
||||
|
||||
Once a Weave network is set up, you can query the connections using the `weave status connections` command:
|
||||
|
||||
$ weave status connections
|
||||
<-192.168.122.25:43889 established fastdp a6:66:4f:a5:8a:11(ubuntu1204)
|
||||
|
||||
Where fastdp indicates that fast datapath is being used on a connection. If fastdp is not shown, the field displays `sleeve` indicating Weave Net's fall-back encapsulation method:
|
||||
|
||||
$ weave status connections
|
||||
<- 192.168.122.25:54782 established sleeve 8a:50:4c:23:11:ae(ubuntu1204)
|
||||
|
||||
### <a name="mtu"></a>Packet size (MTU)
|
||||
|
||||
The Maximum Transmission Unit, or MTU, is the technical term for the
|
||||
limit on how big a single packet can be on the network. Weave Net
|
||||
defaults to 1376 bytes, but you can set a smaller size if your
|
||||
underlying network has a tighter limit, or set a larger size for
|
||||
better performance.
|
||||
|
||||
The underlying network must be able to deliver packets of the size
|
||||
specified plus overheads of around 84-87 bytes (the final MTU should be
|
||||
divisible by four), or else Weave Net will
|
||||
fall back to Sleeve for that connection. This requirement applies
|
||||
to _every path_ between peers.
|
||||
|
||||
To specify a different MTU, before launching Weave Net set the
|
||||
environment variable `WEAVE_MTU`. For example, for a typical "jumbo
|
||||
frame" configuration:
|
||||
|
||||
$ WEAVE_MTU=8916 weave launch host2 host3
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Using Weave Net](/site/using-weave.md)
|
||||
* [How Fastdp Works](/site/how-it-works/fastdp-how-it-works.md)
|
||||
* [Performance measurements](/blog/weave-docker-networking-performance-fast-data-path/)
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
title: Adding and Removing Hosts Dynamically
|
||||
menu_order: 90
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
To add a host to an existing Weave network, launch Weave Net on the
|
||||
host, and supply the address of at least one host. Weave Net
|
||||
automatically discovers any other hosts in the network and establishes
|
||||
connections with them if it can (in order to avoid unnecessary
|
||||
multi-hop routing).
|
||||
|
||||
In some situations existing Weave Net hosts may be unreachable from
|
||||
the new host due to firewalls, etc. However, it is still possible to
|
||||
add the new host, provided that inverse connections, for example, from
|
||||
existing hosts to the new hosts, are available.
|
||||
|
||||
To accomplish this, launch Weave Net onto the new host without
|
||||
supplying any additional addresses and then, from one of the existing
|
||||
hosts run:
|
||||
|
||||
host# weave connect $NEW_HOST
|
||||
|
||||
Any other existing hosts on the Weave network will attempt to
|
||||
establish connections to the new host as well.
|
||||
|
||||
### Instructing Peers to Forget a Host
|
||||
|
||||
To instruct a peer to forget a particular host specified to it via
|
||||
`weave launch` or `weave connect` run:
|
||||
|
||||
host# weave forget $DECOMMISSIONED_HOST
|
||||
|
||||
This prevents the peer from reconnecting to that host once
|
||||
connectivity to it is lost, and can be used to administratively remove
|
||||
any decommissioned peers from the network.
|
||||
|
||||
### Bulk Replacing Hosts
|
||||
|
||||
Hosts can also be bulk-replaced. All existing hosts will be forgotten,
|
||||
and the new hosts added:
|
||||
|
||||
host# weave connect --replace $NEW_HOST1 $NEW_HOST2
|
||||
|
||||
### Restarting Docker and Weave Net
|
||||
|
||||
If Weave Net is restarted by Docker it automatically remembers any
|
||||
previous connect and forget operations, however if you stop it
|
||||
manually and launch it again, it will not remember any prior connects.
|
||||
If you want to launch again and retain the results of those operations
|
||||
use `--resume`:
|
||||
|
||||
host# weave launch --resume
|
||||
|
||||
> **Note:** In this case, you cannot specify a list of addresses,
|
||||
> since the previous peer list is used exclusively.
|
||||
|
||||
For complete control over the peer topology, disable automatic
|
||||
discovery using the `--no-discovery` option with `weave launch`.
|
||||
|
||||
If discovery if disabled, Weave Net only connects to the addresses
|
||||
specified at launch time and with `weave connect`.
|
||||
|
||||
To return a list of all hosts and their peer connections established
|
||||
with `weave launch` and `weave connect` run:
|
||||
|
||||
host# weave status targets
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Enabling Multi-Cloud, Multi-Hop Networking and Routing](/site/using-weave/multi-cloud-multi-hop.md)
|
||||
* [Stopping and Removing Peers](/site/ipam/stop-remove-peers-ipam.md)
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: Integrating with the Host Network
|
||||
menu_order: 60
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
Weave application networks can be integrated with an external host network, establishing connectivity between the host and with application containers running anywhere.
|
||||
|
||||
For example, returning to the [netcat example](/site/using-weave.md), you’ve now decided that you need to have the application containers that are running on `$HOST2` accessible by other hosts and containers.
|
||||
|
||||
On `$HOST2` run:
|
||||
|
||||
host2$ weave expose
|
||||
10.2.1.132
|
||||
|
||||
This command grants the host access to all of the application containers in the default subnet. An IP address is allocated by Weave Net especially for that purpose, and is returned after running `weave expose`.
|
||||
|
||||
Now you are able to ping the host:
|
||||
|
||||
host2$ ping 10.2.1.132
|
||||
|
||||
And you can also ping the `a1` netcat application container residing on `$HOST1`:
|
||||
|
||||
host2$ ping $(weave dns-lookup a1)
|
||||
|
||||
### Exposing Multiple Subnets
|
||||
|
||||
Multiple subnet addresses can be exposed or hidden using a single command:
|
||||
|
||||
host2$ weave expose net:default net:10.2.2.0/24
|
||||
10.2.1.132 10.2.2.130
|
||||
host2$ weave hide net:default net:10.2.2.0/24
|
||||
10.2.1.132 10.2.2.130
|
||||
|
||||
### Adding Exposed Addresses to weaveDNS
|
||||
|
||||
Exposed addresses can also be added to weaveDNS by supplying fully qualified domain names:
|
||||
|
||||
host2$ weave expose -h exposed.weave.local
|
||||
10.2.1.132
|
||||
|
||||
### <a name="routing"></a>Routing from Another Host
|
||||
|
||||
After running `weave expose`, you can use Linux routing to provide
|
||||
access to the Weave network from hosts that are not running Weave Net:
|
||||
|
||||
ip route add <network-cidr> via <exposing-host>
|
||||
|
||||
Where,
|
||||
|
||||
* `<network-cidr>` is an IP address range in use on Weave Net,
|
||||
for example, `10.2.0.0/16` or `10.32.0.0/12` and,
|
||||
* `<exposing-host>` is the address of the machine on which you ran `weave expose`.
|
||||
|
||||
>**Note:** You must ensure that the [IP subnet used by Weave
|
||||
Net](/site/ipam.md#range) does not clash with anything on those other
|
||||
hosts.
|
||||
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Using Weave Net](/site/using-weave.md)
|
||||
* [General information on IP Addresses, Routes and Networks](/site/how-it-works/ip-addresses.md)
|
||||
* [Managing Services - Exporting, Importing, Binding and Routing](/site/using-weave/service-management.md)
|
||||
@@ -0,0 +1,164 @@
|
||||
---
|
||||
title: Monitoring with Prometheus
|
||||
menu_order: 105
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
Two endpoints are exposed: one for the Weave Net router, and, when deployed as
|
||||
a [Kubernetes Addon](/site/kube-addon.md), one for the [network policy
|
||||
controller](/site/kube-addon.md#npc).
|
||||
|
||||
### Router Metrics
|
||||
|
||||
The endpoint address is `localhost:6782`; the following metrics are
|
||||
exposed:
|
||||
|
||||
* `weave_connections` - Number of peer-to-peer connections.
|
||||
* `weave_connection_terminations_total` - Number of peer-to-peer
|
||||
connections terminated.
|
||||
* `weave_ips` - Number of IP addresses.
|
||||
* `weave_max_ips` - Size of IP address space used by allocator.
|
||||
* `weave_dns_entries` - Number of DNS entries.
|
||||
* `weave_flows` - Number of FastDP flows.
|
||||
* `weave_ipam_pending_allocates` - Number of pending allocates.
|
||||
* `weave_ipam_pending_claims` - Number of pending claims.
|
||||
|
||||
#### Publish Router Metrics Endpoint
|
||||
|
||||
By default, when started via `weave launch`, weave listens on its local
|
||||
interface to serve metrics. To publish your metrics throughout your cluster,
|
||||
e.g. if your prometheus server is installed on a different host machine,
|
||||
you need to set `WEAVE_STATUS_ADDR` to your corresponding IP and port.
|
||||
Default port is 6782.
|
||||
|
||||
`WEAVE_STATUS_ADDR=X.X.X.X:PORT`
|
||||
|
||||
You can set `WEAVE_STATUS_ADDR=0.0.0.0:6782` to listen on all interfaces,
|
||||
but be aware, this may expose your metrics to the public internet.
|
||||
|
||||
### Kubernetes Network Policy Controller Metrics
|
||||
|
||||
The endpoint address is `localhost:6781`; the following metric is
|
||||
exposed:
|
||||
|
||||
* `weavenpc_blocked_connections_total` - Connection attempts blocked
|
||||
by policy controller.
|
||||
|
||||
# Static Configuration for Weave Net
|
||||
|
||||
The following YAML fragment can be used in your Prometheus configuration to
|
||||
scrape the router metrics endpoint:
|
||||
|
||||
```
|
||||
scrape_configs:
|
||||
- job_name: 'weave'
|
||||
scrape_interval: 15s
|
||||
static_configs:
|
||||
- targets: ['localhost:6782']
|
||||
```
|
||||
|
||||
# Discovery Configuration for Kubernetes
|
||||
|
||||
If you're running Weave in conjunction with Kubernetes, it is possible
|
||||
to discover the endpoints for all nodes automatically. The following
|
||||
Kubernetes config will install and configure Prometheus 1.3 on your
|
||||
cluster and configure it to discover and scrape the Weave endpoints:
|
||||
|
||||
```
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: prometheus
|
||||
data:
|
||||
prometheus.yml: |-
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
scrape_configs:
|
||||
- job_name: 'weave'
|
||||
kubernetes_sd_configs:
|
||||
- api_server:
|
||||
role: pod
|
||||
relabel_configs:
|
||||
- source_labels: [__meta_kubernetes_namespace,__meta_kubernetes_pod_label_name]
|
||||
action: keep
|
||||
regex: ^kube-system;weave-net$
|
||||
- source_labels: [__meta_kubernetes_pod_container_name,__address__]
|
||||
action: replace
|
||||
target_label: __address__
|
||||
regex: ^weave;(.+?)(?::\d+)?$
|
||||
replacement: $1:6782
|
||||
- source_labels: [__meta_kubernetes_pod_container_name,__address__]
|
||||
action: replace
|
||||
target_label: __address__
|
||||
regex: ^weave-npc;(.+?)(?::\d+)?$
|
||||
replacement: $1:6781
|
||||
- source_labels: [__meta_kubernetes_pod_container_name]
|
||||
action: replace
|
||||
target_label: job
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
name: prometheus
|
||||
name: prometheus
|
||||
spec:
|
||||
selector:
|
||||
app: prometheus
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: prometheus
|
||||
protocol: TCP
|
||||
port: 9090
|
||||
nodePort: 30900
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: prometheus
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: prometheus
|
||||
template:
|
||||
metadata:
|
||||
name: prometheus
|
||||
labels:
|
||||
app: prometheus
|
||||
spec:
|
||||
containers:
|
||||
- name: prometheus
|
||||
image: prom/prometheus:v1.3.0
|
||||
args:
|
||||
- '-config.file=/etc/prometheus/prometheus.yml'
|
||||
ports:
|
||||
- name: web
|
||||
containerPort: 9090
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /etc/prometheus
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: prometheus
|
||||
```
|
||||
|
||||
# Weave Cloud Integration
|
||||
|
||||
Finally, you can configure your local Prometheus instance to push
|
||||
metrics to Weave Cloud by including the following fragment in the
|
||||
`prometheus.yml` above (after replacing `<WEAVE_CLOUD_TOKEN>` with
|
||||
your own token):
|
||||
|
||||
```
|
||||
remote_write:
|
||||
url: http://frontend.dev.weave.works/api/prom/push
|
||||
basic_auth:
|
||||
password: <WEAVE_CLOUD_TOKEN>
|
||||
```
|
||||
|
||||
For information on getting started with Weave Cloud metrics, including
|
||||
on how to obtain your Weave Cloud token, please go
|
||||
[here](https://github.com/weaveworks/cortex).
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: Enabling Multi-Cloud, Multi-Hop Networking and Routing
|
||||
menu_order: 100
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
|
||||
### Enabling Multi-Cloud Networking
|
||||
|
||||
Before multi-cloud networking can be enabled, you must configure the network to allow
|
||||
connections through Weave Net's control and data ports on the Docker hosts. By default, the
|
||||
control port defaults to TCP 6783, and the data ports to
|
||||
UDP 6783/6784.
|
||||
|
||||
To override Weave Net’s default ports, specify a port using
|
||||
the `WEAVE_PORT` setting. For example, if WEAVE_PORT is
|
||||
set to `9000`, then Weave uses TCP 9000 for its control
|
||||
port and UDP 9000/9001 for its data port.
|
||||
|
||||
>**Important!** It is recommended that all peers be given
|
||||
the same setting.
|
||||
|
||||
|
||||
### Multi-hop routing
|
||||
|
||||
A network of containers across more than two hosts can be
|
||||
established even when there is only partial connectivity
|
||||
between the hosts.
|
||||
|
||||
Weave Net routes traffic between containers as long as
|
||||
there is at least one *path* of connected hosts
|
||||
between them.
|
||||
|
||||
For example, if a Docker host in a local data center can
|
||||
connect to hosts in GCE and EC2, but the latter two cannot
|
||||
connect to each other, containers in the latter two can
|
||||
still communicate and Weave Net in this instance will route the
|
||||
traffic via the local data center.
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Finding and Adding Hosts Dynamically](/site/using-weave/finding-adding-hosts-dynamically.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
title: Securing Connections Across Untrusted Networks
|
||||
menu_order: 80
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
|
||||
To connect containers across untrusted networks, Weave Net peers can be instructed to encrypt traffic by supplying a `--password` option or by using the `WEAVE_PASSWORD` environment variable during `weave launch`.
|
||||
|
||||
For example:
|
||||
|
||||
host1$ weave launch --password wfvAwt7sj
|
||||
|
||||
or
|
||||
|
||||
host1$ export WEAVE_PASSWORD=wfvAwt7sj
|
||||
host1$ weave launch
|
||||
|
||||
>**NOTE**: The command line option takes precedence over the environment variable.
|
||||
|
||||
> To avoid leaking your password via the kernel process table or your
|
||||
> shell history, we recommend you store it in a file and capture it
|
||||
> in a shell variable prior to launching weave: `export
|
||||
> WEAVE_PASSWORD=$(cat /path/to/password-file)`
|
||||
|
||||
To guard against dictionary attacks, the password needs to be reasonably strong,
|
||||
with at least 50 bits of entropy. An easy way to generate a random password that
|
||||
satisfies this requirement is:
|
||||
|
||||
< /dev/urandom tr -dc A-Za-z0-9 | head -c9 ; echo
|
||||
|
||||
The same password must be specified for all Weave Net peers, by default both control and data plane traffic will then use authenticated encryption.
|
||||
|
||||
As an optimization, you can selectively disable data plane encryption
|
||||
if some of your peers are co-located in a trusted network, for example
|
||||
within the boundary of your own data center. List these networks using
|
||||
the `--trusted-subnets` argument with `weave launch`:
|
||||
|
||||
weave launch --password wfvAwt7sj --trusted-subnets 10.0.2.0/24,192.168.48.0/24
|
||||
|
||||
If *both* peers at the end of a connection consider the other to be in
|
||||
the same trusted subnet, Weave Net attempts to establish non-encrypted
|
||||
connectivity. Otherwise communication is encrypted which imposes overheads.
|
||||
|
||||
Configured trusted subnets are shown in [`weave status`](/site/troubleshooting.md#weave-status).
|
||||
|
||||
Be aware that:
|
||||
|
||||
* Containers will be able to access the router REST API if fast datapath is disabled. You can prevent this by setting:
|
||||
[`icc=false`](https://docs.docker.com/engine/userguide/networking/default_network/container-communication/#communication-between-containers).
|
||||
* Containers are able to access the router control and data plane
|
||||
ports, but this can be mitigated by enabling encryption.
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Weave Encryption](/site/how-it-works/encryption.md)
|
||||
* [Using Fast Datapath](/site/using-weave/fastdp.md)
|
||||
@@ -0,0 +1,118 @@
|
||||
---
|
||||
title: Managing Services - Exporting, Importing, Binding and Routing
|
||||
menu_order: 70
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
This section contains the following topics:
|
||||
|
||||
* [Exporting Services](#exporting)
|
||||
* [Importing Services](#importing)
|
||||
* [Binding Services](#binding)
|
||||
* [Routing Services](#routing)
|
||||
* [Dynamically Changing Service Locations](#change-location)
|
||||
|
||||
|
||||
|
||||
### <a name="exporting"></a>Exporting Services
|
||||
|
||||
Services running in containers on a Weave network can be made
|
||||
accessible to the outside world (and, more generally, to other networks)
|
||||
from any Weave Net host, irrespective of where the service containers are
|
||||
located.
|
||||
|
||||
Returning to the [netcat example service](/site/using-weave.md),
|
||||
you can expose the netcat service running on `HOST1` and make it accessible to the outside world via `$HOST2`.
|
||||
|
||||
First, expose the application network to `$HOST2`, as explained in [Integrating with the Host Network](/site/using-weave/host-network-integration.md):
|
||||
|
||||
host2$ weave expose
|
||||
10.2.1.132
|
||||
|
||||
Then add a NAT rule that routes the traffic from the outside world to the destination container service.
|
||||
|
||||
host2$ iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 2211 \
|
||||
-j DNAT --to-destination $(weave dns-lookup a1):4422
|
||||
|
||||
In this example, it is assumed that the "outside world" is connecting to `$HOST2` via 'eth0'. The TCP traffic to port 2211 on the external IPs will be routed to the 'nc' service running on port 4422 in the container a1.
|
||||
|
||||
With the above in place, you can connect to the 'nc' service from anywhere using:
|
||||
|
||||
echo 'Hello, world.' | nc $HOST2 2211
|
||||
|
||||
>**Note:** Due to the way routing is handled in the Linux kernel, this won't work when run *on* `$HOST2`.
|
||||
|
||||
Similar NAT rules to the above can be used to expose services not just to the outside world but also to other, internal, networks.
|
||||
|
||||
### <a name="importing"></a>Importing Services
|
||||
|
||||
Applications running in containers on a Weave network can be given access to services, which are only reachable from certain
|
||||
Weave hosts, regardless of where the actual application containers are located.
|
||||
|
||||
Expanding on the [netcat service example](/site/using-weave.md), you now decide to add a third, non-containerized, netcat service. This additional netcat service runs on `$HOST3`, and listens on port 2211, but it is not on the Weave network.
|
||||
|
||||
An additional caveat is that `$HOST3` can only be reached from `$HOST1`, which is not accessible via `$HOST2`. Nonetheless, you still need to make the `$HOST3` service available to an application that is running in a container on `$HOST2`.
|
||||
|
||||
To satisfy this scenario, first [expose the application network to the host](/site/using-weave/host-network-integration.md) by running the following on `$HOST1`:
|
||||
|
||||
host1$ weave expose -h host1.weave.local
|
||||
10.2.1.3
|
||||
|
||||
Then add a NAT rule, which routes from the above IP to the destination service.
|
||||
|
||||
host1$ iptables -t nat -A PREROUTING -p tcp -d 10.2.1.3 --dport 3322 \
|
||||
-j DNAT --to-destination $HOST3:2211
|
||||
|
||||
This allows any application container to reach the service by connecting to 10.2.1.3:3322. So if `$HOST3` is running a
|
||||
netcat service on port 2211:
|
||||
|
||||
host3$ nc -lk -p 2211
|
||||
|
||||
You can now connect to it from the application container running on `$HOST2` using:
|
||||
|
||||
root@a2:/# echo 'Hello, world.' | nc host1 3322
|
||||
|
||||
Note that you should be able to run this command from any application container.
|
||||
|
||||
### <a name="binding"></a>Binding Services
|
||||
|
||||
Importing a service provides a degree of indirection that allows late and dynamic binding, similar to what can be achieved with a proxy.
|
||||
|
||||
Referring back to the [netcat services example that is running on three hosts](#importing), the application containers are completely unaware that the service they are accessing at `10.2.1.3:3322` actually resides on `$HOST3:2211`.
|
||||
|
||||
You can point application containers to another service location by changing the above NAT rule, without altering the applications.
|
||||
|
||||
### <a name="routing"></a>Routing Services
|
||||
|
||||
You can combine the service export and service import features to establish connectivity between applications and services residing on disjointed networks, even if those networks are separated by firewalls and have overlapping IP ranges.
|
||||
|
||||
Each network imports its services into Weave Net, while at the same time, exports from Weave Net any services that are required by its applications. In this scenario, there are no application containers (although, there could be). Weave Net is acting as an address translation and routing facility, and uses the Weave container network as an intermediary.
|
||||
|
||||
Expanding on the [netcat example](/site/using-weave.md), you can also import an additional netcat service running on `$HOST3` into Weave Net via `$HOST1`.
|
||||
|
||||
Begin importing the service onto `$HOST2` by first exposing the application network:
|
||||
|
||||
host2$ weave expose
|
||||
10.2.1.3
|
||||
|
||||
Then add a NAT rule which routes traffic from the `$HOST2` network (for example, anything that can connect to `$HOST2`) to the service endpoint on the Weave network:
|
||||
|
||||
host2$ iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 4433 \
|
||||
-j DNAT --to-destination 10.2.1.3:3322
|
||||
|
||||
Now any host on the same network as `$HOST2` is able to access the service:
|
||||
|
||||
echo 'Hello, world.' | nc $HOST2 4433
|
||||
|
||||
### <a name="change-location"></a>Dynamically Changing Service Locations
|
||||
|
||||
Furthermore, as explained in Binding Services, service locations can be dynamically altered without having to change any of the applications that access them.
|
||||
|
||||
For example, you can move the netcat service to `$HOST4:2211` and it will retain its 10.2.1.3:3322 endpoint on the Weave network.
|
||||
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Adding and Removing Hosts Dynamically](/site/using-weave/finding-adding-hosts-dynamically.md)
|
||||
* [Enabling Multi-Cloud, Multi-Hop Networking and Routing](/site/using-weave/multi-cloud-multi-hop.md)
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
title: Manually Specifying the IP Address of a Container
|
||||
menu_order: 20
|
||||
search_type: Documentation
|
||||
---
|
||||
|
||||
Containers are automatically allocated an IP address that is unique across the Weave network. You can see which address was allocated by running, [`weave ps`](/site/troubleshooting.md#weave-status):
|
||||
|
||||
host1$ weave ps a1
|
||||
a7aee7233393 7a:44:d3:11:10:70 10.32.0.2/12
|
||||
|
||||
Weave Net detects when a container has exited and releases its allocated addresses so they can be re-used by the network.
|
||||
|
||||
See the [Automatic IP Address Management](/site/ipam.md) and also an explanation of [the basics of IP addressing](/site/how-it-works/ip-addresses.md) for further details.
|
||||
|
||||
Instead of allowing Weave Net to allocate IP addresses automatically (using IPAM), there may be instances where you need to control a particular container or a cluster by setting an IP address for it.
|
||||
|
||||
You can specify an IP address and a network explicitly, using Classless Inter-Domain Routing or [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing).
|
||||
|
||||
For example, we can launch a couple of containers on `$HOST1` and
|
||||
`$HOST2`, respectively, with specified IP addresses, as follows...
|
||||
|
||||
On `$HOST1`:
|
||||
|
||||
host1$ docker run -e WEAVE_CIDR=10.2.1.1/24 -ti weaveworks/ubuntu
|
||||
root@7ca0f6ecf59f:/#
|
||||
|
||||
And `$HOST2`:
|
||||
|
||||
host2$ docker run -e WEAVE_CIDR=10.2.1.2/24 -ti weaveworks/ubuntu
|
||||
root@04c4831fafd3:/#
|
||||
|
||||
Then test that the container on `$HOST2` can be reached from the container on `$HOST1`:
|
||||
|
||||
root@7ca0f6ecf59f:/# ping -c 1 -q 10.2.1.2
|
||||
PING 10.2.1.2 (10.2.1.2): 48 data bytes
|
||||
--- 10.2.1.2 ping statistics ---
|
||||
1 packets transmitted, 1 packets received, 0% packet loss
|
||||
round-trip min/avg/max/stddev = 1.048/1.048/1.048/0.000 ms
|
||||
|
||||
And in the other direction...
|
||||
|
||||
root@04c4831fafd3:/# ping -c 1 -q 10.2.1.1
|
||||
PING 10.2.1.1 (10.2.1.1): 48 data bytes
|
||||
--- 10.2.1.1 ping statistics ---
|
||||
1 packets transmitted, 1 packets received, 0% packet loss
|
||||
round-trip min/avg/max/stddev = 1.034/1.034/1.034/0.000 ms
|
||||
|
||||
The IP addresses and netmasks can be set to anything, but ensure they don’t conflict with any of the IP ranges in use on the hosts or with IP addresses used by any external services to which the hosts or containers may need to connect.
|
||||
|
||||
Individual IP addresses given to containers must, of course, be unique. If you pick an address that the automatic allocator has already assigned a warning appears.
|
||||
|
||||
**See Also**
|
||||
|
||||
* [Managing Services - Exporting, Importing, Binding and Routing](/site/using-weave/service-management.md)
|
||||
* [Allocating IPs in a Specific Range](/site/using-weave/configuring-weave.md)
|
||||
* [Automatic IP Address Management](/site/ipam.md)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Reference in new issue
Block a user