K8s Tips — CNI Introduction

Tony
6 min readJan 17, 2024

What is CNI

CNI stands for Container Network Interface. It is a specification and a set of tools to configure network interfaces in Linux containers.

K8s uses CNI as an interface between network providers and K8s networking. When you set up a K8s cluster, you need to select a CNI plugin, and this plugin is responsible for setting up networking for the Pods. For example, the following shows a K8s cluster uses Flannel plugin:

$ kubectl get pods -n kube-flannel
NAME READY STATUS RESTARTS AGE
kube-flannel-ds-6dmrm 1/1 Running 0 71d
kube-flannel-ds-8t5lx 1/1 Running 0 64d
kube-flannel-ds-9sg4q 1/1 Running 0 71d
kube-flannel-ds-flfm9 1/1 Running 0 64d
kube-flannel-ds-fnm9b 1/1 Running 0 69d
kube-flannel-ds-frfmr 1/1 Running 0 71d

CNI gives you a great deal of flexibility and allows K8s to not be bound to any specific networking implementation. You can choose from a variety of CNI plugins, each offering different features. Some popular CNI plugins include Calico, Flannel, Weave, Cilium, and many others.

The responsibilities of a CNI plugin in a K8s cluster include:

  • Assigning IP addresses to Pods and their containers.

--

--

Tony
Tony

No responses yet