liveBook · Manning

CNI plugin

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

A CNI plugin is software that configures container network interfaces and related network resources according to the Container Network Interface specification.

A CNI plugin configures Linux container network interfaces and related resources according to the Container Network Interface specification. In Kubernetes, it enables pod communication across nodes while keeping the cluster independent of a particular network provider. section 2.3.2 section 6.5

A CNI plugin performs several operational tasks:

  • Runs when a pod is scheduled, configuring interfaces, IP addresses, routes, and possibly network policies. section 2.3.2
  • Removes the configured network resources when the pod is deleted. section 2.3.2
  • Runs as a DaemonSet on cluster nodes and can provide an overlay such as VXLAN for node-to-node traffic. section 6.5
  • Can be identified with kubectl get pods -n kube-system or kubectl get ds -n kube-system; its configuration commonly resides under /etc/cni/net.d. section 2.3.2 section 6.5

Inspecting kindnet

A kind cluster uses kindnet as its CNI. Check it with kubectl -n kube-system get ds kindnet, then inspect /etc/cni/net.d/10-kindnet.conflist. The configuration uses the ptp plugin with host-local IPAM, a pod subnet of 10.244.0.0/24, a default route, and port mapping. section 2.3.2

$ kubectl get pods -n kube-system
NAME                                      READY   STATUS    RESTARTS      
AGE
calico-kube-controllers-fdf5f5495-7lzbl   1/1     Running   2 (43m ago)   9d
canal-vmgsc                               2/2     Running   2 (43m ago)   9d
canal-xntjt                               2/2     Running   2 (43m ago)   9d
coredns-7695687499-27bvx                  1/1     Running   1 (43m ago)   9d
coredns-7695687499-wfcnf                  1/1     Running   1 (43m ago)   9d
etcd-controlplane                         1/1     Running   3 (43m ago)   9d
kube-apiserver-controlplane               1/1     Running   2 (43m ago)   9d
kube-controller-manager-controlplane      1/1     Running   2 (43m ago)   9d
kube-proxy-nhwwx                          1/1     Running   1 (43m ago)   9d
kube-proxy-nlw5b                          1/1     Running   2 (43m ago)   9d
kube-scheduler-controlplane               1/1     Running   2 (43m ago)   9d

Use the kube-system pod listing to identify active networking components, including Calico or other CNI-related workloads. section 2.3.2

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains the pod lifecycle, DaemonSet deployment, inspection commands, configuration files, and VXLAN context without detailing provider internals.
Examples
Uses kindnet inspection, kube-system listings, a 10-kindnet.conflist file, and Flannel installation and verification exercises.
What you can do after
Operate and troubleshoot CNI deployments by identifying the active plugin, inspecting its configuration, and installing or replacing providers.
How it connects
Connects pod networking with the Container Runtime Interface, DaemonSets, network policies, overlays, VXLAN, Flannel, Calico, and kindnet.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.