Skip to content
Snippets Groups Projects
Commit b5c2058f authored by Alex de Cock Buning's avatar Alex de Cock Buning
Browse files

Documentation: added more documentation

Added documentation to the examples section, for the cdn example and the build section, specifying how to use the build and push script
parent 53f755fe
No related branches found
No related tags found
1 merge request!2repo: added new directory where utils scripts will be
source diff could not be displayed: it is too large. Options to address this: view the blob.
# Build Directory
This directory contains Dockerfiles and scripts for building and pushing Docker images for different components of the project.
The files and scripts are meant to be run directly in the /L2S-M directory, as the COPY instructions will refer to the /L2S-M/src directory.
## Directory Structure:
- `./build/switch`: Dockerfile and related files for building the l2sm-switch Docker image.
- `./build/controller`: Dockerfile and related files for building the l2sm-controller Docker image.
- `./build/operator`: Dockerfile and related files for building the l2sm-operator Docker image.
- `./build/build_and_push_images.sh`: Bash script for automating the build and push process of Docker images.
## Script Usage:
### 1. Build Images:
```bash
./build/build_and_push_images.sh build
```
This command will build Docker images for l2sm-switch, l2sm-controller, and l2sm-operator.
### 2. Push Images:
```bash
./build/build_and_push_images.sh push
```
This command will push previously built Docker images to the specified DockerHub repository.
### 3. Build and Push Images:
```bash
./build/build_and_push_images.sh build_push
```
This command will both build and push Docker images.
Note: Make sure to set the appropriate environment variables in the script before running. (The repo name and the version tag)
For any additional details or customization, refer to the respective Dockerfiles and the build script.
...@@ -5,113 +5,170 @@ ...@@ -5,113 +5,170 @@
This example demonstrates the isolation of traffic between pods using custom networks with L2S-M In this scenario, two networks, v-network-1 and v-network-2, are created, and three pods (cdn-server, router, and content-server) are connected. The objective is to showcase how traffic can be isolated through a router (router) connecting the two networks. This example demonstrates the isolation of traffic between pods using custom networks with L2S-M In this scenario, two networks, v-network-1 and v-network-2, are created, and three pods (cdn-server, router, and content-server) are connected. The objective is to showcase how traffic can be isolated through a router (router) connecting the two networks.
## Topology ## Topology
The example video shows a Cluster scenario with three nodes, where a pod will be deployed in each Node, as shown in the following figure.
<p align="center">
<img src="../../assets/video-server-example.svg" width="400">
</p>
The following example doesn't really need a three Node scenario, it can be used with just a Node in the Cluster. Through the example guide, we will create the following resources:
### Networks ### Networks
- v-network-1 - [v-network-1](./v-network-1.yaml)
- v-network-2 - [v-network-2](./v-network-2.yaml)
Two virtual L2S-M networks, without any additional configuration.
### Pods ### Pods
- **podA (CDN Server)** Note: The configurations specified can be seen in each Pod YAML specification.
- **[cdn-server](./cdn-server.yaml) (CDN Server)**
This pod will act as a CDN server, it's just an alpine image with the following pre-configuration:
- IP: 10.0.1.2 - IP: 10.0.1.2
- Network: v-network-1 - Network: v-network-1
- **podB (Router)** - **[router](./router.yaml) (Router)**
This pod will act as a router, where we could launch some firewall rules if we wanted. It will have the following pre-configuration:
- Networks: v-network-1, v-network-2 - Networks: v-network-1, v-network-2
- IP: 10.0.1.1 (net1) and 10.0.2.1 (net2) - IP: 10.0.1.1 (net1) and 10.0.2.1 (net2)
- Forwarding enabled
- **podC (Content Server)** - **[content-server](./content-server.yaml) (Content Server)**
This pod will act as a content server. The image can be found at the [./video-server directory](./video-server/). It's an NGINX image with a video file that will be served. It has the following pre-configuration:
- IP: 10.0.2.2 - IP: 10.0.2.2
- Network: v-network-2 - Network: v-network-2
## Procedure ## Procedure
1. **Show Nodes** Follow the steps below to demonstrate the isolation of traffic between pods using custom networks with L2S-M:
### 1. Create Virtual Networks
- Create two virtual L2S-M networks: [v-network-1](./v-network-1.yaml) and [v-network-2](./v-network-2.yaml).
```bash ```bash
kubectl get nodes kubectl create -f ./examples/cdn/v-network-1.yaml
``` ```
2. **Show Pods**
```bash ```bash
kubectl get pods -o wide kubectl create -f ./examples/cdn/v-network-2.yaml
``` ```
3. **Show Networks** ### 2. Verify Network Creation
```bash - This step is optional, but it will help you understand how L2S-M internally work, if you already know a bit about SDN and network overlays.
- Check the logs in the `l2sm-controller` and `l2sm-operator` to ensure that the virtual networks have been successfully created.
```bash
kubectl get net-attach-def kubectl get net-attach-def
``` ```
4. **Operator Logs**
```bash ```bash
kubectl logs l2sm-operator-667fc88c57-p7krv kubectl logs l2sm-operator-667fc88c57-p7krv
``` ```
```bash
kubectl logs l2sm-controller-d647b7fb5-kb2f7
```
Show the creation of networks and pod attachments. ### 3. Deploy Pods
5. **Controller Logs** - Deploy the following three pods, each attached to specific networks:
- [cdn-server](./cdn-server.yaml) (CDN Server) attached to `v-network-1`
- [router](./router.yaml) (Router) connected to both `v-network-1` and `v-network-2`
- [content-server](./content-server.yaml) (Content Server) attached to `v-network-2`
```bash ```bash
kubectl create -f ./examples/cdn/cdn-server.yaml
```
```bash
kubectl create -f ./examples/cdn/content-server.yaml
```
```bash
kubectl create -f ./examples/cdn/router.yaml
```
### 4. Verify Intent Creation
- Examine the logs in the `l2sm-controller` to confirm that the intents for connecting the pods to their respective networks have been successfully created.
```bash
kubectl logs l2sm-controller-d647b7fb5-kb2f7 kubectl logs l2sm-controller-d647b7fb5-kb2f7
``` ```
```bash
kubectl get pods
```
Demonstrate the creation of networks and connections between pods. ### 5. Inspect Content Server
6. **Enter CDN and Content-Server Pods** - Enter the `content-server` pod and check its IP configuration.
- Start the server to serve the video content.
To setup the server, enter it by doing the ``exec`` command
```bash ```bash
kubectl exec -it content-server /bin/bash # Enter Content-Server pod kubectl exec -it content-server /bin/bash
``` ```
In the Content-Server pod, execute the following commands: In the Content-Server pod, execute the following commands:
```bash ```bash
ip a s # Show IP addresses ip a s # Show IP addresses
``` ```
```bash ```bash
ip r s # Display routing table ip r s # Display routing table
``` ```
```bash ```bash
nginx # Start the server nginx # Start the server
``` ```
### 6. Inspect CDN Server
- Enter the `cdn-server` pod and add the `curl` command to initiate communication with the content server.
- Check the IPs to ensure connectivity.
To test the connectivity from the cdn server: To test the connectivity from the cdn server:
```bash ```bash
kubectl exec -it cdn-server /bin/bash # Enter CDN-Server pod kubectl exec -it cdn-server /bin/bash # Enter CDN-Server pod
``` ```
In the CDN pod, execute the following commands: In the CDN pod, execute the following commands:
```bash
apk add curl # Install the curl cli
```
```bash ```bash
ip a s # Show IP addresses ip a s # Show IP addresses
``` ```
```bash ```bash
ip r s # Display routing table ip r s # Display routing table
``` ```
### 7. Perform Traceroute
- Execute a traceroute to observe any intermediaries between the content server and CDN server. It should appear like theres a step between them, the router.
```bash ```bash
traceroute 10.0.2.2 # Trace route to content-server traceroute 10.0.2.2 # Trace route to content-server
``` ```
### 8. Test Communication
- Perform a `curl` from the CDN server to the content server to initiate video retrieval.
```bash ```bash
curl http://10.0.2.2/big_buck_bunny.avi --output video.avi --limit-rate 2M # Download video curl http://10.0.2.2/big_buck_bunny.avi --output video.avi --limit-rate 2M # Download video
``` ```
Note: leave this Pod running while doing the next steps.
While the video downloads delete the router pod: ### 9. Introduce Interruption
- Delete the pod for the router and observe that the video communication stops.
While the video downloads delete the router pod:
```bash ```bash
kubectl delete pod router kubectl delete pod router
``` ```
And watch how the traffic stops. You may continue the download by doing: ### 10. Restore Connection
```bash
kubectl create -f router.yaml - Restart the router pod and verify the reconnection of the `content-server` and `cdn-server`.
```
Where the router pod enter the two desired networks and will start funcion again.
```bash
kubectl create -f router.yaml
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment