Implementing a CNI plugin

Learn how to implement a CNI plugin.

Overview

The CNI is a Kubernetes networking framework that allows users to dynamically configure the container networking through a configuration file and a group of executable binaries. These binaries can be written with any language, such as Go, Bash, and so on. With the help of the CNI, we can opt-in our customizations to meet our business needs.

Various vendors and open-source projects provide dozens of network solutions and plugins to address different infrastructures and underlying environments. Most of the time, we don’t need to implement a CNI plugin on our own. Appropriate plugins can be found that meet our needs. Even if we do need to implement one, we don’t normally build it from scratch. We can build it on top of other chained plugins, such as ptp, vlan, bridge, portmap, firewall, etc. These chained plugins are already implemented and provided with the CNI.

In this lesson, we’ll implement a simple CNI plugin called debug, which will help with debugging and troubleshooting CNI plugins. This debug plugin will also help us better understand how CNI executable plugins are invoked and how they work.

Let’s get started.

Get hands-on with 1200+ tech skills courses.