Cluster Architecture

Extension Interfaces (CNI, CSI, CRI)

Container Runtime Interface, Container Storage Interface, and Container Network Interface — Kubernetes extensibility model.

Overview

Kubernetes defines standard interfaces so that networking, storage, and container runtime implementations can be swapped without changing core code.

InterfaceFull NamePurposeExamples
CRIContainer Runtime InterfaceLets kubelet manage containers via any compliant runtimecontainerd, CRI-O
CSIContainer Storage InterfaceLets storage providers expose volumes without in-tree pluginsEBS CSI, NFS CSI, Ceph CSI
CNIContainer Network InterfaceLets network providers configure pod networkingCalico, Flannel, Cilium

CRI — Container Runtime Interface

How it works

  • The kubelet communicates with the container runtime via a gRPC interface over a Unix socket
  • CRI defines two services: RuntimeService (pod/container lifecycle) and ImageService (image pull/remove)
  • Any runtime implementing the CRI gRPC API can be used with Kubernetes

Supported runtimes

RuntimeSocket PathNotes
containerdunix:///run/containerd/containerd.sockDefault in most distributions (kubeadm, EKS, GKE, AKS)
CRI-Ounix:///var/run/crio/crio.sockLightweight, purpose-built for Kubernetes

Checking the configured runtime

# shows ContainerRuntime in the STATUS column
kubectl get nodes -o wide

# check kubelet's configured runtime socket
ps aux | grep kubelet | grep container-runtime-endpoint

# or inspect kubelet config
cat /var/lib/kubelet/config.yaml | grep containerRuntimeEndpoint

crictl — CRI CLI tool

crictl is the standard CLI for interacting with any CRI-compatible runtime directly on a node.

# configure crictl to use the runtime socket
sudo crictl config runtime-endpoint unix:///run/containerd/containerd.sock
CommandDescription
crictl psList running containers
crictl podsList pods
crictl imagesList images
crictl inspect <container-id>Inspect a container
crictl logs <container-id>View container logs
crictl pull <image>Pull an image
crictl statsDisplay container resource usage

CSI — Container Storage Interface

How it works

  • CSI replaces the old in-tree volume plugins with an out-of-tree plugin model
  • A CSI driver consists of two components:
    • Controller plugin — runs as a Deployment; handles provisioning/deleting volumes, attach/detach
    • Node plugin — runs as a DaemonSet on every node; handles mount/unmount on the node
  • Storage providers ship their own CSI drivers that implement the CSI spec

Common CSI drivers

DriverStorage Backend
ebs.csi.aws.comAWS EBS
pd.csi.storage.gke.ioGCP Persistent Disk
disk.csi.azure.comAzure Disk
nfs.csi.k8s.ioNFS
rbd.csi.ceph.comCeph RBD

Checking CSI drivers

# list all CSI drivers registered in the cluster
kubectl get csidrivers

# show which CSI drivers are available on each node
kubectl get csinodes

# list storage classes (shows which provisioner/CSI driver each uses)
kubectl get storageclasses

StorageClass using a CSI driver

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com    # CSI driver name
parameters:
  type: gp3
  fsType: ext4
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer

For more on PersistentVolumes, PVCs, and StorageClasses, see Volumes.

CNI — Container Network Interface

  • CNI plugins configure pod networking — assigning IPs, setting up routes, and connecting pods
  • The kubelet invokes the CNI plugin binary when a pod is created or deleted
  • Plugin binaries live in /opt/cni/bin/, config files in /etc/cni/net.d/

For detailed coverage of CNI plugins (Calico, Flannel, Cilium, etc.), see CNI.

Useful Commands

# check container runtime for each node
kubectl get nodes -o wide

# list CSI drivers
kubectl get csidrivers

# list CSI node info
kubectl get csinodes -o wide

# check CNI plugin config on a node
ls /etc/cni/net.d/

# check CNI plugin binaries on a node
ls /opt/cni/bin/

# inspect kubelet runtime endpoint
cat /var/lib/kubelet/config.yaml | grep containerRuntimeEndpoint

# list pods for CSI driver components
kubectl get pods -A | grep csi