Skip to content

Commit 9018b69

Browse files
Updated installation scripts and docs, general cleanup (#141)
Co-authored-by: Lorenzo Moro <[email protected]>
1 parent eb6392c commit 9018b69

File tree

11 files changed

+297
-807
lines changed

11 files changed

+297
-807
lines changed

docs/installation/installation.md

Lines changed: 215 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,224 @@ However, if you want to test FLUIDOS Node on your cluster already setup, we sugg
1717
<!-- --- -->
1818
<!--
1919
**⚠️ ATTENTION:** The script is currently in an experimental phase, so it may not work as expected. If any issues arise, it may be tricky to understand and terminate the script, as many sub-tasks are executed in the background. We are aware of these issues and are actively working to resolve them.
20-
21-
If you want to use a **working and tested script** to test the FLUIDOS Node within a KinD environment, please refer to the [**Testbed**](../../testbed/kind/README.md) section. -->
20+
-->
2221

2322
<!-- --- -->
2423

24+
## Prerequisites
25+
26+
Below are the required tools, along with the versions used by the script:
27+
28+
- [Docker](https://docs.docker.com/get-docker/) v28.1.1
29+
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) v1.33.0
30+
- [KIND](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) v0.27.0
31+
- [Helm](https://helm.sh/docs/intro/install/) v3.17.3
32+
- [Liqo CLI tool](https://docs.liqo.io/en/stable/installation/liqoctl.html) v1.0.0
33+
34+
> **Note** The installation script will automatically check if these tools are installed and will ask for your confirmation to install them if they are missing. It will install each tool using a fixed version, except for Docker, which will be installed at the stable version. After Docker installation, an additional CLI command will be required to ensure its proper functionality.
35+
36+
## Common issues with KIND
37+
38+
This setup leverages KIND (Kubernetes IN Docker) to quickly provision a reliable testbed for evaluating the FLUIDOS Node architecture.
39+
40+
When running multiple KIND clusters, certain issues may arise—particularly related to swap memory usage and system-level resource limits. To mitigate these problems, it is strongly recommended to execute the following commands prior to starting the installation:
41+
42+
1. `sudo swapoff -a`
43+
2. `sudo sysctl fs.inotify.max_user_instances=8192`
44+
3. `sudo sysctl fs.inotify.max_user_watches=524288`
45+
2546
## Testbed installation
2647

27-
To execute the script, use the following command:
48+
### What will be installed
2849

29-
```bash
30-
cd tools/scripts
31-
. ./setup.sh
32-
```
50+
The script will create two different types of Kubernetes clusters, each consisting of 3 nodes, as defined in the files located in the `quickstart/kind` directory:
51+
52+
- **fluidos-consumer**: This cluster (also known as a FLUIDOS node) will act as a consumer of FLUIDOS resources. It will use the REAR protocol to communicate with the provider cluster, retrieve available Flavors, and reserve the one that best matches the solver’s request, proceeding to purchase it.
53+
54+
- **fluidos-provider**: This cluster (also known as a FLUIDOS node) will act as a provider of FLUIDOS resources. It will offer its available Flavors in response to requests from the consumer, managing their reservation and sale accordingly.
55+
56+
### Installation
57+
58+
1. Clone the repository
59+
60+
```sh
61+
git clone https://github.com/fluidos-project/node.git
62+
```
63+
64+
2. Move into the KIND Example folder
65+
66+
```sh
67+
cd node/tools/scripts
68+
```
69+
70+
3. Launch the `setup.sh` script
71+
72+
```sh
73+
./setup.sh
74+
```
75+
76+
4. No command-line arguments are currently supported; instead, the installation mode is selected interactively at the beginning of the script execution. The available options are:
77+
78+
- `1` Install the FLUIDOS Node using the demo testbed (one consumer and one provider cluster) via KIND.
79+
80+
- `2` Install the FLUIDOS Node using a custom setup with n consumer clusters and m provider clusters via KIND.
81+
82+
For both options, you will be prompted to choose:
83+
84+
- Whether to install from the official remote FLUIDOS repository or use local repositories and build all components locally.
85+
86+
- Whether to enable resource auto-discovery.
87+
88+
- Whether to enable LAN node discovery.
89+
90+
An example prompt flow is shown below:
91+
92+
```sh
93+
1. Use demo KIND environment (one consumer and one provider)
94+
2. Use a custom KIND environment with n consumer and m provides
95+
Please enter the number of the option you want to use:
96+
1
97+
Do you want to use local repositories? [y/n] y
98+
Do you want to enable resource auto discovery? [y/n] y
99+
Do you want to enable LAN node discovery? [y/n] y
100+
```
101+
102+
5. At the beginning of the script execution, a check is performed to ensure all [required tools](#prerequisites) are installed. If any dependencies are missing, the script will prompt you for confirmation before proceeding with their automatic installation.
103+
> **Note** The tools will be installed assuming Linux as the operating system. If you are not using Linux, you will need to install them manually.
104+
105+
If Docker is not installed and you choose to install it, the script will terminate after its installation. This is necessary because the Docker group must be reloaded in order to use Docker commands without sudo. You can achieve this by running:
106+
107+
```sh
108+
newgrp docker
109+
```
110+
111+
This command opens a new shell with updated group permissions. After executing it, simply restart the installation script.
112+
113+
6. After executing the script, you can verify the status of the pods in the consumer cluster using the following commands:
114+
115+
```sh
116+
export KUBECONFIG=fluidos-consumer-1-config
117+
kubectl get pods -n fluidos
118+
```
119+
120+
To inspect the provider cluster, use its corresponding kubeconfig file:
33121

34-
No options are available through the CLI, but you can choose the installation mode by choosing the right option during the script execution.
35-
The option supported are:
122+
```sh
123+
export KUBECONFIG=fluidos-provider-1-config
124+
kubectl get pods -n fluidos
125+
```
36126

37-
- `1` to install the FLUIDOS Node as the demo testbed through KIND
127+
Alternatively, to avoid switching the KUBECONFIG environment variable each time, you can directly specify the configuration file path and context when using kubectl. The paths to the generated configuration files are displayed at the end of the script execution:
38128

39-
- `2` to install the FLUIDOS Node in n consumer clusters and m provider clusters through KIND
129+
```sh
130+
kubectl get pods --kubeconfig "$PWD/fluidos-consumer-1-config" --context kind-fluidos-consumer -n fluidos
131+
```
40132

41-
For both options, you can choose to install from either the official remote FLUIDOS repository or the local repository, building all the components locally.
133+
This approach enables seamless monitoring of both consumer and provider clusters without needing to re-export environment variables manually.
134+
135+
7. You should see 4 pods running on the `fluidos-consumer` cluster and 4 pods running on the `fluidos-provider` cluster:
136+
137+
- `node-local-resource-manager-<random>`
138+
- `node-network-manager-<random>`
139+
- `node-rear-controller-<random>`
140+
- `node-rear-manager-<random>`
141+
142+
### Usage
143+
144+
In this section, we will guide you through interacting with the FLUIDOS Node at a high level. If you prefer to interact with the FLUIDOS Node using its Custom Resource Definitions (CRDs), please refer to the [Low-Level Usage](../../docs/usage/usage.md) section.
145+
146+
Let’s start by deploying an example `solver` Custom Resource (CR) on the `fluidos-consume`r cluster.
147+
148+
1. Open a new terminal on the repo and move into the `deployments/node/samples` folder
149+
150+
```sh
151+
cd deployments/node/samples
152+
```
153+
154+
2. Set the `KUBECONFIG` environment variable to the `fluidos-consumer` cluster
155+
156+
```sh
157+
export KUBECONFIG=../../../tools/scripts/fluidos-consumer-1-config
158+
```
159+
160+
3. Deploy the `solver` CR
161+
162+
```sh
163+
kubectl apply -f solver.yaml
164+
```
165+
166+
> **Note**
167+
> Please review the **architecture** field and change it to **amd64** or **arm64** according to your local machine architecture.
168+
169+
4. Check the result of the deployment
170+
171+
```sh
172+
kubectl get solver -n fluidos
173+
```
174+
175+
The result should be something like this:
176+
177+
```sh
178+
NAME INTENT ID FIND CANDIDATE RESERVE AND BUY PEERING STATUS MESSAGE AGE
179+
solver-sample intent-sample true true true Solved Solver has completed all the phases 83s
180+
```
181+
182+
5. Other resources have been created and can be inspected using the following commands:
183+
184+
```sh
185+
kubectl get flavors.nodecore.fluidos.eu -n fluidos
186+
kubectl get discoveries.advertisement.fluidos.eu -n fluidos
187+
kubectl get reservations.reservation.fluidos.eu -n fluidos
188+
kubectl get contracts.reservation.fluidos.eu -n fluidos
189+
kubectl get peeringcandidates.advertisement.fluidos.eu -n fluidos
190+
kubectl get transactions.reservation.fluidos.eu -n fluidos
191+
```
192+
193+
6. The infrastructure for resource sharing has been established. A demo namespace should now be created in the fluidos-consumer cluster:
194+
195+
```sh
196+
kubectl create namespace demo
197+
```
198+
199+
The namespace can then be offloaded to the fluidos-provider cluster using the following command:
200+
201+
```sh
202+
liqoctl offload namespace demo --pod-offloading-strategy Remote
203+
```
204+
205+
Once the namespace has been offloaded, any workload can be deployed within it. As an example, the provided Kubernetes deployment can be used:
206+
207+
```sh
208+
kubectl apply -f nginx-deployment.yaml -n demo
209+
```
210+
211+
Another example involves deploying the `solver-service`, which requests a provider with a database service.
212+
213+
1. Deploy the mock database service in the provider cluster.
214+
215+
```sh
216+
export KUBECONFIG=../../../tools/scripts/fluidos-consumer-1-config
217+
kubectl apply -f service-blueprint-db.yaml
218+
```
219+
220+
2. Deploy the `solver` CR
221+
222+
```sh
223+
kubectl apply -f solver-service.yaml
224+
```
225+
226+
3. Check the result of the deployment
227+
228+
```sh
229+
kubectl get solver -n fluidos
230+
```
231+
232+
The result should be something like this:
233+
234+
```sh
235+
NAME INTENT ID FIND CANDIDATE RESERVE AND BUY PEERING STATUS MESSAGE AGE
236+
solver-sample-service intent-sample-service true true true Solved Solver has completed all the phases 83s
237+
```
42238

43239
### Clean Development Environment
44240

@@ -65,7 +261,8 @@ To ensure you have Liqo, please run the following script:
65261

66262
```bash
67263
cd ../../tools/scripts
68-
./install-liqo.sh <provider> <cluster-name> $KUBECONFIG
264+
chmod +x install_liqo.sh
265+
./install_liqo.sh <provider> <cluster-name> $KUBECONFIG <liqoctl PATH>
69266
```
70267

71268
Please, note that you need to pass a few parameters.
@@ -75,11 +272,14 @@ Please, note that you need to pass a few parameters.
75272
1. kubeadm
76273
2. k3s
77274
3. kind
275+
78276
- "cluster-name": this is the name you want to give to your Liqo local cluster (e.g.: `fluidos-turin-1`)
79277

80278
- $KUBECONFIG: it is the typical environment variable that points to the path of your Kubernetes cluster configuration.
81279

82-
For more information, check out [Liqo official documentation](https://docs.liqo.io/en/v0.10.3/installation/install.html#install-with-liqoctl) for all supported providers.
280+
- "liqoctl PATH": it is the path to the liqoctl command. If installed via Liqo guide, liqoctl is sufficient.
281+
282+
For more information, check out [Liqo official documentation](https://docs.liqo.io/en/v1.0.0/installation/install.html#install-with-liqoctl) for all supported providers.
83283

84284
**DISCLAIMER:** before going ahead, ensure that at least one node is tagged with `node-role.fluidos.eu/worker: "true"` and, if acting as a provider, choose the nodes that exposes their Kubernetes resources with the label `node-role.fluidos.eu/resources: "true"`.
85285

@@ -91,7 +291,7 @@ helm repo add fluidos https://fluidos-project.github.io/node/
91291
92292
helm upgrade --install node fluidos/node \
93293
-n fluidos --version "$FLUIDOS_VERSION" \
94-
--create-namespace -f consumer-values.yaml \
294+
--create-namespace -f $PWD/node/quickstart/utils/consumer-values.yaml \
95295
--set networkManager.configMaps.nodeIdentity.ip="$NODE_IP" \
96296
--set rearController.service.gateway.nodePort.port="$REAR_PORT" \
97297
--set networkManager.config.enableLocalDiscovery="$ENABLE_LOCAL_DISCOVERY" \

0 commit comments

Comments
 (0)