Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Example: Isolating an NGINX server from a CDN with Custom L2SM networks
## Overview
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
### Networks
- v-network-1
- v-network-2
### Pods
- **podA (CDN Server)**
- IP: 10.0.1.2
- Network: v-network-1
- **podB (Router)**
- Networks: v-network-1, v-network-2
- IP: 10.0.1.1 (net1) and 10.0.2.1 (net2)
- **podC (Content Server)**
- IP: 10.0.2.2
- Network: v-network-2
## Procedure
1. **Show Nodes**
```bash
kubectl get nodes
```
2. **Show Pods**
```bash
kubectl get pods -o wide
```
3. **Show Networks**
```bash
kubectl get net-attach-def
```
4. **Operator Logs**
```bash
kubectl logs l2sm-operator-667fc88c57-p7krv
```
Show the creation of networks and pod attachments.
5. **Controller Logs**
```bash
kubectl logs l2sm-controller-d647b7fb5-kb2f7
```
Demonstrate the creation of networks and connections between pods.
6. **Enter CDN and Content-Server Pods**
To setup the server, enter it by doing the ``exec`` command
```bash
kubectl exec -it content-server /bin/bash # Enter Content-Server pod
```
In the Content-Server pod, execute the following commands:
```bash
ip a s # Show IP addresses
```
```bash
ip r s # Display routing table
```
```bash
nginx # Start the server
```
To test the connectivity from the cdn server:
```bash
kubectl exec -it cdn-server /bin/bash # Enter CDN-Server pod
```
In the CDN pod, execute the following commands:
```bash
ip a s # Show IP addresses
```
```bash
ip r s # Display routing table
```
```bash
traceroute 10.0.2.2 # Trace route to content-server
```
```bash
curl http://10.0.2.2/big_buck_bunny.avi --output video.avi --limit-rate 2M # Download video
```
While the video downloads delete the router pod:
```bash
kubectl delete pod router
```
And watch how the traffic stops. You may continue the download by doing:
```bash
kubectl create -f router.yaml
```
Where the router pod enter the two desired networks and will start funcion again.