This is the repository for the Google Summer of Code project P4-Enabled Container Migration in Kubernetes. The project is actively being worked on.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
This project uses the P4Runtime API to communicate with the switch. The P4Runtime API is implemented in the P4Runtime Interface (PI).
When installing PI, make sure to configure with the --with-proto
flag to compile proto files and --with-python_prefix=/path/to/this/repo/.venv
to install the p4 library in your virtual environment. For example:
./configure --with-proto --with-python_prefix=/home/p4/p4containerflow/.venv
After running:
sudo make install
The p4 library files in your .venv
will be owned by the root user. Make sure to change owner by running:
sudo chown -R $USER .venv
make build-images
This will build the following images:
tcp-client
: A simple TCP client that sends a message to a server (this will run in h1-pod)tcp-server
: A simple TCP server that listens for a message from a client (this will run in all other pods)
You can configure the target IP of the client and the port of the server in the tcp/Containerfile.server and tcp/Containerfile.client files respectively.
Furthermore, you can specify which image to run in the hosts by changing the IMG
and ARGS
variables in scripts/switch_container/build.sh.
In the root directory of the repo, run:
make
This will create compile the p4 code, create 4 networks (h1-net, h2-net, h3-net, h4-net), a pod in each network (h1-pod, h2-pod, h3-pod, h4-pod) and a host container in each network (h1, h2, h3, h4). A switch (s1) will be created in the host network, connected to all the host networks. For details on the network topology, refer to scripts/switch_container/build.sh. Finally, the script will run the controller, which will program the switch with the p4 code.
In a new terminal, run:
make tcp-client
This will run the tcp-client
image in the h1-pod
. The client will continuously send messages to the switch (load balancer), at address 10.1.1.11
, which should be load-balanced between h2 and h3.