Skip to content

Commit d543b9f

Browse files
committed
docs: improve NAT and manual peering documentation
1 parent 7abcb94 commit d543b9f

File tree

5 files changed

+73
-12
lines changed

5 files changed

+73
-12
lines changed
28.8 KB
Loading

docs/advanced/manual-peering.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Manual peering
22

3+
In the [peer two clusters](../usage/peer.md) section of this documentation, we used the `liqoctl peer`, which automatically configure each single module of Liqo to create a peering between two clusters. However, this command can be used when:
4+
5+
- the user is willing to use `liqoctl` to create the peerings between the clusters
6+
- all Liqo modules need to be used and configured
7+
- the cluster acting as provider can expose the service for the Wireguard gateway server that the client can reach
8+
- a single ResourceSlice (request for resources) backed by a single VirtualNode is enough
9+
10+
Whenever you need a different configuration, like, for example:
11+
12+
- you want to configure Liqo peerings via a [declarative approach](./peering/peering-via-cr.md) via CRs.
13+
- the networking module is not required, either because the inter-cluster networking is not needed or because networking is provided by a third party
14+
- it is required to configure the WireGuard gateway server on the cluster consumer (e.g. the nodes of the cluster provider are [behind a NAT](./nat.md))
15+
- The consumer needs to create multiple requests for resources (ResourceSlice) or you want to customize the way resources are distributed on virtual nodes
16+
17+
then, you will need to set up the peering with the cluster, by configuring each single module separatly.
18+
319
In this section, you will discover how to interact with each Liqo module without using the automatic peering method.
420

521
## Prerequirements

docs/advanced/nat.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,57 @@
1-
# NAT Firewall
1+
# Configure a Liqo gateway server behind a NAT
22

3-
In Case a **gateway server** is behind a NAT firewall, the following steps are required to establish the connection:
4-
You can configure the settings for the connection by setting the following *annotations* in the `values.yaml` file or by using the `liqoctl` command line `--set` option:
3+
There might be some cases, especially when working in lab environments, where **it is not possible to configure the gateway server service as `LoadBalancer`**, and it should be configured via a `NodePort` service.
4+
However, the nodes of the cluster might not be directly reachable, as for example, they are behind a NAT.
55

6-
Under the `networking.gatewayTemplates.server.service.annotations` key, you can set the following annotations:
6+
In such cases, it is not possible to configure the Liqo peering directly with the `liqoctl peer` command, as the gateway client would point to the internal address and port of the server gateway.
77

8-
* **liqo.io/override-address**: the public IP address of the NAT firewall.
9-
* **liqo.io/override-port**: the public port of the NAT firewall.
8+
In this documentation page, we are going to describe how to configure Liqo in this kind of cases.
109

11-
```{admonition} Tip
12-
In case you need to have multiple gateways behind the same NAT firewall, you need to override the port for each peer using the `--server-port` flag at peering time.
13-
This flag works with `liqoctl peer` and `liqoctl network connect` commands.
10+
## Case A: Use a NodePort service with the provider cluster behind a NAT and client directly reachable
11+
12+
![The provider is behind a NAT](../_static/images/advanced/nat/provider_nat.png)
13+
14+
There might be the case in which the cluster provider nodes are not directly reachable, as for example they are behind a NAT, while the consumer can be directly reached.
15+
16+
By default using the `peer` command, the gateway server is configured on the provider cluster, which, in this case, is not directly reachable, as behind the NAT.
17+
To fix this issue, we can swap the roles of the gateways, configuring the client on the cluster provider and the server on the consumer.
18+
To do so, you need to use [manual peering](./manual-peering.md), setting the inter-cluster network up separately.
19+
20+
This solution allows to configure the Liqo networking without the need to configure port-mapping on the NAT, as we moved the gateway server on the nodes that are directly reachable.
21+
22+
In the case you would like to keep the gateway server on the provider, you can follow the instructions on the next paragraph.
23+
24+
## Case B: Use a NodePort service when both cluster provider and consumer are behind a NAT
25+
26+
The solution presented in this section is valid when both consumer and provider clusters are reachable from an IP and a port different than the ones configured on the nodes of the clusters, for example, when they both are behind a NAT.
27+
28+
In this case, **you must configure port-mapping on the NAT** so that the traffic directed on a specific port of the NAT can be forwarded to one of nodes of the cluster.
29+
30+
When network is configured via `liqoctl` commands, if the service is of type `NodePort`, Liqo automatically uses the external IPs of the nodes to configure the gateway client.
31+
You can force Liqo to use the public IP of the NAT and the port of the NAT where we configured port mapping, by providing some options at installation time.
32+
33+
Create a `values.yaml` file like the following:
34+
35+
```{code-block} yaml
36+
:caption: "values.yaml"
37+
networking:
38+
gatewayTemplates:
39+
server:
40+
service:
41+
annotations:
42+
liqo.io/override-address: <NAT_ADDRESS>
43+
liqo.io/override-port: <NAT_PORT>
44+
```
45+
46+
Where:
47+
48+
- **liqo.io/override-address** is the public IP address of the NAT firewall.
49+
- **liqo.io/override-port** is the public port of the NAT firewall where you configured port mapping.
50+
51+
At this point you can pass this file to the `install` command:
52+
53+
```bash
54+
liqoctl install <HERE_YOUR_PROVIDER> <ARG...> --values <PATH_TO>/values.yaml
1455
```
56+
57+
If you use [Helm to install Liqo](../installation/install.md#install-with-helm), you can add those fields in your own `values.yaml`.

docs/advanced/peering/inter-cluster-network.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ The unpeer process will automatically remove the Liqo Gateway from the tenant na
2626

2727
## Manual on cluster couple
2828

29-
When you have access to both clusters, you can configure the network connectivity for all the successive peering creations.
29+
When you have access to both clusters, you can configure the inter-cluster network connectivity via the `liqoctl network` command.
3030

31-
First, you need to initialize the network:
31+
Note that when you use the `liqoctl network` command, the remote kubeconfig/context provided as argument, is the one of the cluster where we want to configure the server gateway of Wireguard tunnel.
32+
33+
The first step to configure network is initializing the network:
3234

3335
```bash
3436
liqoctl network init \

docs/usage/peer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Ensure you selected the correct target cluster before issuing *liqoctl* commands
2929
## Requirements
3030

3131
The peering command requires the user to provide the kubeconfig of **both** *consumer* and *provider* clusters, as it will apply resources on both clusters.
32-
To perform a peering without having access to both clusters, you need to manually apply on your cluster the resources and exchange with the remote cluster all the resources needed over out-of-band mediums (refer to the individual guides describing the procedure for each module).
32+
To perform a peering without having access to both clusters, you need to manually apply on your cluster the resources and exchange with the remote cluster all the resources needed over out-of-band mediums (refer to the [individual guides](../advanced/manual-peering.md) describing the procedure for each module).
3333

3434
## Performed steps
3535

0 commit comments

Comments
 (0)