Skip to content

Container Network Interface (CNI)

A minimal, runtime-agnostic spec plus Go libraries that let any container runtime hand pod networking to pluggable executables.

  • Category: Service Mesh & Networking
  • CNCF maturity: Incubating
  • Language: Go
  • License: Apache-2.0
  • Repository: containernetworking/cni
  • Documented at commit: 7c27007 (2025-12-15, after v1.3.0)

What it is

CNI is a specification and a set of Go libraries for configuring network interfaces in Linux containers. The repository holds three things: the written spec, the reference Go library that runtimes embed, and a sample command-line tool. It deliberately does not ship a data plane. Real plugins such as bridge and host-local live in a separate repository, and projects like Calico, Cilium, and Flannel are third-party implementations of the same contract (README.md:13).

The contract is narrow on purpose. CNI concerns itself only with network connectivity of containers and with reclaiming resources when a container is deleted (README.md:13). Everything happens across a process boundary: a runtime executes a plugin binary, passes intent through environment variables and a JSON document on stdin, and reads a JSON result from stdout.

A runtime such as containerd, CRI-O, or kubelet links the libcni library, parses a network configuration from disk, and invokes plugins in order. The library handles config injection, plugin discovery, result caching, and version negotiation so each plugin stays small.

When to use it

  • You are building or extending a container runtime and need a standard way to attach pods to a network.
  • You are writing a network plugin and want it to work under any CNI-compliant runtime without per-runtime code.
  • You run Kubernetes and are choosing or chaining network plugins (Calico, Cilium, Flannel, Multus) that all speak CNI.
  • It is not the right layer when you want a turnkey data plane or network policy engine. CNI is the interface; you still pick an implementation that provides those features.

In this deep-dive

Sources

  1. containernetworking/cni (GitHub)
  2. CNI SPEC.md
  3. cnitool docs
  4. containernetworking/plugins (reference plugins)
  5. CNCF hosts Container Networking Interface (CNI)
  6. CNCF project page: Container Network Interface (CNI)
  7. CNCF becomes home to rkt
  8. Nuage: CNM vs CNI container networking standards
  9. Kubernetes Network Plugins
  10. Kubernetes CNI comparison 2026 (OneUptime)
  11. Civo: Calico vs Flannel vs Cilium