|
| 1 | +# Setup to run VPP |
| 2 | + |
| 3 | +The Data Plane Development Kit (DPDK) is a set of libraries and drivers for |
| 4 | +fast packet processing. Vector Packet Processing (VPP) is a platform |
| 5 | +extensible framework that provides out-of-the-box production quality |
| 6 | +switch and router functionality. VPP is a high performance packet-processing |
| 7 | +stack that can run on commodity CPUs. Enabling VPP with DPDK support can |
| 8 | +yield significant performance improvements over a Linux\* bridge providing a |
| 9 | +switch with DPDK vhost-user ports. |
| 10 | + |
| 11 | +For more information about VPP visit their [wiki](https://wiki.fd.io/view/VPP). |
| 12 | + |
| 13 | +## Install and configure Kata Containers |
| 14 | + |
| 15 | +Follow the [Kata Containers' setup instructions](https://github.com/kata-containers/documentation/wiki/Developer-Guide). |
| 16 | + |
| 17 | +In order to make use of vhost-user based interfaces, the container needs to be backed |
| 18 | +by huge pages. Hugepage support is required for the large memory pool allocation used for |
| 19 | +DPDK packet buffers. This is a feature which must be configured within the Linux Kernel. See |
| 20 | +[the DPDK documentation](https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#use-of-hugepages-in-the-linux-environment) |
| 21 | +for details on how to enable for the host. After enabling huge-pages support on the host system, |
| 22 | +update the Kata configuration to enable huge page support in the guest kernel: |
| 23 | + |
| 24 | +``` |
| 25 | +$ sudo sed -i -e 's/^# *\(enable_hugepages\).*=.*$/\1 = true/g' /usr/share/defaults/kata-containers/configuration.toml |
| 26 | +``` |
| 27 | + |
| 28 | + |
| 29 | +## Install VPP |
| 30 | + |
| 31 | +Follow the [VPP installation instructions](https://wiki.fd.io/view/VPP/Installing_VPP_binaries_from_packages). |
| 32 | + |
| 33 | +After a successful installation, your host system is ready to start |
| 34 | +connecting Kata Containers with VPP bridges. |
| 35 | + |
| 36 | +### Install the VPP Docker\* plugin |
| 37 | + |
| 38 | +To create a Docker network and connect Kata Containers easily to that network through |
| 39 | +Docker, install a VPP Docker plugin. |
| 40 | + |
| 41 | +To install the plugin, follow the [plugin installation instructions](https://github.com/clearcontainers/vpp). |
| 42 | + |
| 43 | +This VPP plugin allows the creation of a VPP network. Every container added |
| 44 | +to this network is connected through an L2 bridge-domain provided by VPP. |
| 45 | + |
| 46 | +## Example: Launch two Kata Containers using VPP |
| 47 | + |
| 48 | +To use VPP, use Docker to create a network that makes use of VPP. |
| 49 | +For example: |
| 50 | + |
| 51 | +``` |
| 52 | +$ sudo docker network create -d=vpp --ipam-driver=vpp --subnet=192.168.1.0/24 --gateway=192.168.1.1 vpp_net |
| 53 | +``` |
| 54 | + |
| 55 | +Test connectivity by launching two containers: |
| 56 | +``` |
| 57 | +$ sudo docker run --runtime=kata-runtime --net=vpp_net --ip=192.168.1.2 --mac-address=CA:FE:CA:FE:01:02 -it busybox bash -c "ip a; ip route; sleep 300" |
| 58 | +
|
| 59 | +$ sudo docker run --runtime=kata-runtime --net=vpp_net --ip=192.168.1.3 --mac-address=CA:FE:CA:FE:01:03 -it busybox bash -c "ip a; ip route; ping 192.168.1.2" |
| 60 | +``` |
| 61 | + |
| 62 | +These commands setup two Kata Containers connected via a VPP L2 bridge |
| 63 | +domain. The first of the two VMs displays the networking details and then |
| 64 | +sleeps providing a period of time for it to be pinged. The second |
| 65 | +VM displays its networking details and then pings the first VM, verifying |
| 66 | +connectivity between them. |
| 67 | + |
| 68 | +After verifying connectivity, cleanup with the following commands: |
| 69 | + |
| 70 | +``` |
| 71 | +$ sudo docker kill $(sudo docker ps --no-trunc -aq) |
| 72 | +$ sudo docker rm $(sudo docker ps --no-trunc -aq) |
| 73 | +$ sudo docker network rm vpp_net |
| 74 | +$ sudo service vpp stop |
| 75 | +``` |
| 76 | + |
0 commit comments