Jacob Dunefsky about   projects   academics   work   publications  

Kubernetes networking plugin.

December 2021

Source code: https://github.com/jacobdunefsky/k8s-test-net


Back to all projects

As my final project in my computer networks class, I implemented a CNI plugin which provides networking functionality to a Kubernetes cluster running on Linux nodes. The plugin consisted of two components. One component was the CNI script itself, responsible for assigning IP addresses and setting up veth pairs when a new pod is created. The other component was a setup script, to be run on each node, responsible for ensuring that each node is automatically connected to the same overlay network as the other nodes in the cluster.

In developing the CNI script, I made ample use of two great tutorials: one by Kevin Sookocheff and one by Siarhei Matsiukevich. In particular, the CNI script resembles that provided by the latter tutorial, although it was reimplemented from first principles rather than copy-pasted, and new features were added (e.g. a dependency on nmap was removed, and a dependence on hardcoded values was replaced with values programmatically obtained from kubectl).

However, in developing the setup script, I had to fly completely solo, as both tutorials not only assumed that the cluster was run on a cloud provider's servers, but also that the user would manually set up routing between nodes. The setup script, however, automatically sets up routing without assuming anything about whether a cloud provider is used.

Over the course of this project, I not only obtained much hands-on experience with Kubernetes, but I got to dive deep into virtual networking with Linux, using industry-standard systems like network namespaces, veth pairs and bridges, and VXLAN.