Added documentation website content, and a workflow to publish it to GitHub Pages

* Copied, rearranged and modified the contents of the old site directory for Jekyll static site generator, into the website directory
* Added some Jekyll-specific things for looks, including:
  * _config.yaml, Gemfile.* and 404.html files
  * _data, _layouts and assets directories and their content
* Added .github/workflows/github-pages-publish.yml workflow
This commit is contained in:
Raj Chaudhuri committed 2024-03-18 20:37:53 +05:30
1 parent 92779f3e57
commit e2db8a25bd
82 files changed
+6162

No files matched your search

@@ -0,0 +1,70 @@
---
title: Isolating Applications on a Weave Network
menu_order: 5
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]({{ '/install/using-weave' | relative_url }}), 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]({{ '/tasks/ipam/allocation-multi-ipam' | relative_url }})
* [Managing Services - Exporting, Importing, Binding and Routing]({{ '/tasks/manage/service-management' | relative_url }})
+105
View File
@@ -0,0 +1,105 @@
---
title: Configuring IP Routing on an Amazon Web Services Virtual Private Cloud
menu_order: 80
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.
![Weave Net AWS-VPC Mode](weave-net-awsvpc-1007x438.png)
### 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]({{ '/operational-guide/concepts#ip-address-manager-ipam' | relative_url }})
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**
* [Launching Weave Net]({{ '/install/using-weave' | relative_url }})
@@ -0,0 +1,72 @@
---
title: Dynamically Attaching and Detaching Applications
menu_order: 10
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]({{ '/tasks/weave-docker-api/name-resolution-proxy' | relative_url }})),
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]({{ '/tasks/manage/finding-adding-hosts-dynamically' | relative_url }})
+76
View File
@@ -0,0 +1,76 @@
---
title: Using Fast Datapath
menu_order: 60
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]({{ '/concepts/fastdp-how-it-works' | relative_url }}) 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]({{ '/concepts/encryption-implementation' | relative_url }})
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**
* [Launching Weave Net]({{ '/install/using-weave' | relative_url }})
* [How Fastdp Works]({{ '/concepts/fastdp-how-it-works' | relative_url }})
* [Performance measurements](https://web.archive.org/web/20231002233731/https://www.weave.works/blog/weave-docker-networking-performance-fast-data-path/)
@@ -0,0 +1,72 @@
---
title: Adding and Removing Hosts Dynamically
menu_order: 50
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]({{ '/tasks/manage/multi-cloud-multi-hop' | relative_url }})
* [Stopping and Removing Peers]({{ '/tasks/ipam/stop-remove-peers-ipam' | relative_url }})
@@ -0,0 +1,64 @@
---
title: Integrating with the Host Network
menu_order: 20
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]({{ '/install/using-weave' | relative_url }}), 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]({{ '/tasks/ipam/ipam#range' | relative_url }}) does not clash with anything on those other
hosts.
**See Also**
* [Launching Weave Net]({{ '/install/using-weave' | relative_url }})
* [General information on IP Addresses, Routes and Networks]({{ '/concepts/ip-addresses' | relative_url }})
* [Managing Services - Exporting, Importing, Binding and Routing]({{ '/tasks/manage/service-management' | relative_url }})
+5
View File
@@ -0,0 +1,5 @@
---
title: Managing Containerized Applications
menu_order: 10
search_type: Documentation
---
+149
View File
@@ -0,0 +1,149 @@
---
title: Monitoring Weave Net with Prometheus
menu_order: 90
search_type: Documentation
---
Two endpoints are exposed: one for the Weave Net router, and, when deployed as
a [Kubernetes Addon]({{ '/kubernetes/kube-addon' | relative_url }}), one for the [network policy
controller]({{ '/kubernetes/kube-addon#npc' | relative_url }}).
### Router Metrics
* `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_unreachable_count` - Number of unreachable peers that own IPAM addresses.
* `weave_ipam_unreachable_percentage` - Percentage of all IP addresses owned by unreachable peers.
* `weave_ipam_pending_allocates` - Number of pending allocates.
* `weave_ipam_pending_claims` - Number of pending claims.
### Kubernetes Network Policy Controller Metrics
The following metric is
exposed:
* `weavenpc_blocked_connections_total` - Connection attempts blocked
by policy controller.
### Metrics Endpoint Addresses
When installed as a Kubernetes Addon, the router listens for metrics
requests on 0.0.0.0:6782 and the Network Policy Controller listens on
0.0.0.0:6781. No other requests are served on these endpoints.
>Note: If your Kubernetes hosts are exposed to the public internet
then these metrics endpoints will also be exposed.
When started via `weave launch`, by default weave listens on its local
interface to serve metrics and other read-only status requests. To
publish your metrics throughout your cluster, you can set
`WEAVE_STATUS_ADDR`:
`WEAVE_STATUS_ADDR=X.X.X.X:PORT`
Set it to an empty string to disable.
You can also pass the parameter `--metrics-addr=X.X.X.X:PORT` to
`weave launch` to specify an address to listen for metrics only.
# Weave Net Monitoring Setup in Kubernetes using kube-prometheus
Weave Net monitoring can be setup in Kubernetes using the kube-prometheus [library](https://github.com/coreos/kube-prometheus/blob/master/jsonnet/kube-prometheus/kube-prometheus-weave-net.libsonnet) for Weave Net. You can read about the example document [here](https://github.com/coreos/kube-prometheus/blob/master/docs/weave-net-support.md).
Let's setup weave monitoring using [kube-prometheus](https://github.com/coreos/kube-prometheus).
#### Install golang
Follow this [document](https://golang.org/doc/install/source)
#### Install jssonet builder
```
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
```
#### Install jsonnet
Follow this [document](https://github.com/google/jsonnet#building-jsonnet)
#### Install gojsonyaml
```
go get github.com/brancz/gojsontoyaml
```
#### Update dependencies
```
jb update
```
#### Create weave-net.jsonnet
**Note:** Some alert configurations are environment specific and may require modifications of alert thresholds.
```
cat << EOF > weave-net.jsonnet
local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') +
(import 'kube-prometheus/kube-prometheus-weave-net.libsonnet') + {
_config+:: {
namespace: 'monitoring',
},
prometheusAlerts+:: {
groups: std.map(
function(group)
if group.name == 'weave-net' then
group {
rules: std.map(function(rule)
if rule.alert == "WeaveNetFastDPFlowsLow" then
rule {
expr: "sum(weave_flows) < 20000"
}
else if rule.alert == "WeaveNetIPAMUnreachable" then
rule {
expr: "weave_ipam_unreachable_percentage > 25"
}
else
rule
,
group.rules
)
}
else
group,
super.groups
),
},
};
{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
EOF
```
#### Create manifests
```
jsonnet -J vendor -m manifests weave-net.jsonnet | xargs -I{} sh -c 'cat $1 | gojsontoyaml > $1.yaml; rm -f $1' -- {}
```
#### Apply manifests
Applying the created manifests will install the following components in your Kubernetes cluster:
- [Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) "monitoring"
- [Prometheus](https://github.com/prometheus/prometheus)
- [Kube State Metrics](https://github.com/kubernetes/kube-state-metrics)
- [Prometheus Operator](https://github.com/coreos/prometheus-operator) Operator to manage prometheus
- [Grafana](https://grafana.com) Dashboards on top of Prometheus metrics.
- [Weave Net ServiceMonitor](https://github.com/coreos/kube-prometheus/blob/7a85d7d8a6a81eda1db090846759fd6ca6532884/jsonnet/kube-prometheus/kube-prometheus-weave-net.libsonnet#L12-L43) ServiceMonitor brings the weave net metrics to prometheus.
- [Weave Net Service](https://github.com/coreos/kube-prometheus/blob/7a85d7d8a6a81eda1db090846759fd6ca6532884/jsonnet/kube-prometheus/kube-prometheus-weave-net.libsonnet#L7-L11) Weave Net Service which the ServiceMonitor scrapes.
- [Weave Net Grafana Dashboard](https://grafana.com/grafana/dashboards/11789)
- [Weave Net (Cluster) Grafana Dashboard](https://grafana.com/grafana/dashboards/11804)
```
cd manifests
ls *.yaml | grep -e ^prometheus -e ^node -e ^grafana -e ^kube | xargs -I {} kubectl create -f {} -n monitoring
kubectl create -f prometheus-serviceWeaveNet.yaml -n kube-system
kubectl create -f prometheus-serviceMonitorWeaveNet.yaml -n monitoring
```
**Note:** If you want to make changes to the created yamls, please modify the weave-net.jsonnet and recreate the manifests before applying.
@@ -0,0 +1,44 @@
---
title: Enabling Multi-Cloud, Multi-Hop Networking and Routing
menu_order: 70
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]({{ '/tasks/manage/finding-adding-hosts-dynamically' | relative_url }})
@@ -0,0 +1,57 @@
---
title: Securing Connections Across Untrusted Networks
menu_order: 40
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`]({{ '/troubleshooting#weave-status' | relative_url }}).
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]({{ '/concepts/encryption' | relative_url }})
* [Using Fast Datapath]({{ '/tasks/manage/fastdp' | relative_url }})
+118
View File
@@ -0,0 +1,118 @@
---
title: Managing Services - Exporting, Importing, Binding and Routing
menu_order: 30
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]({{ '/install/using-weave' | relative_url }}),
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]({{ '/tasks/manage/host-network-integration' | relative_url }}):
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]({{ '/install/using-weave' | relative_url }}), 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]({{ '/tasks/manage/host-network-integration' | relative_url }}) 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]({{ '/install/using-weave' | relative_url }}), 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]({{ '/tasks/manage/finding-adding-hosts-dynamically' | relative_url }})
* [Enabling Multi-Cloud, Multi-Hop Networking and Routing]({{ '/tasks/manage/multi-cloud-multi-hop' | relative_url }})
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB