Kubernetes CRI: How kubelet Connects to Container Runtimes
The Container Runtime Interface (CRI) is the gRPC contract between kubelet and a node's container runtime. Learn what RuntimeService and ImageService do, how CRI differs from OCI and CNI, which version boundaries matter, and how to diagnose a suspected endpoint failure with crictl.
Kubernetes CRI: How kubelet Connects to Container Runtimes
The Container Runtime Interface (CRI) is the standard gRPC interface through which Kubernetes kubelet asks a node's container runtime to manage Pod sandboxes, containers, their status, and images. CRI is not itself a program that runs containers. It separates kubelet from runtime implementation, allowing Kubernetes components to connect to different CRI implementations without being rebuilt.
What problem does CRI solve?
Kubelet works to reconcile each node's actual state with the desired state of its Pods. The node runtime performs image retrieval, sandbox preparation, and container start and stop operations. If kubelet had to know each runtime's private commands, changing runtimes would require changes to Kubernetes components. CRI defines a common API boundary instead.
CRI has been a stable Kubernetes API since v1.23. Kubelet is the gRPC client; the runtime serves its requests. The API has two main services:
| Service | Responsibility | Example |
|---|---|---|
| RuntimeService | Create, start, stop, and remove Pod sandboxes and containers; report status and related runtime data | Kubelet requests a Pod start or checks its state |
| ImageService | Pull images and list, inspect, or remove unused images | Prepare an image before starting a container |
The exact RPCs and features depend on CRI version and runtime implementation. CRI standardizes the interoperability boundary, not every runtime's internals.
How does a Pod request travel?
Suppose a Deployment requests three replicas. Controllers create Pod objects and the scheduler assigns them to nodes. Each node's kubelet observes its assigned Pods and requests work through CRI.
Deployment / scheduler
| Pod assigned to a node
v
kubelet -- CRI gRPC --> RuntimeService / ImageService
| image, sandbox, container lifecycle
v
lower-level runtime such as an OCI runtimeThis simplified example shows responsibility boundaries. Runtime internals may include a manager such as containerd, a shim, and an OCI runtime such as runc; the exact design varies.
CRI, OCI, and CNI are different
| Name | Boundary | In short |
|---|---|---|
| CRI | Kubernetes kubelet to node runtime | What kubelet asks the runtime to do |
| OCI | Image formats and low-level container runtime behavior | Formats and lifecycle used for images and processes |
| CNI | Network plugin and container runtime | How Pod networking is configured |
CRI support does not mean a runtime independently defines image formats or networking. CNI handles the network-plugin integration, while OCI specifications concern images and lower-level execution.
Compatibility and version boundaries
Kubelet connects to the runtime's CRI socket endpoint, configured in kubelet settings or with --container-runtime-endpoint. RuntimeService and ImageService must be available. Socket paths vary by runtime and distribution; check the node's actual configuration instead of copying an example path.
CRI became stable in Kubernetes v1.23. Kubernetes v1.26 and later kubelets require the CRI v1 API; without it, kubelet may fail to register the node. Check supported versions and API compatibility when upgrading.
Docker Engine can still build images, but Kubernetes removed its direct dockershim integration in v1.24. Building with Docker and using a CRI-compatible runtime on cluster nodes are separate matters. cri-dockerd is a separate adapter for environments that need a Docker runtime path; check the cluster provider's guidance.
Diagnose a suspected CRI failure
A Pending or failed Pod does not automatically mean CRI is broken. If no node was assigned, the issue may precede kubelet-runtime communication. ImagePullBackOff can indicate an image name, credential, network, or image-service problem. A NotReady node plus kubelet logs reporting endpoint or CRI API errors is stronger evidence to investigate that boundary.
On Linux, an authorized operator can use Kubernetes' crictl to inspect a CRI-compatible runtime. Replace the socket path with the node's actual endpoint:
sudo crictl --runtime-endpoint unix:///actual/runtime.sock info
sudo crictl --runtime-endpoint unix:///actual/runtime.sock pods
sudo crictl --runtime-endpoint unix:///actual/runtime.sock ps -aIf info cannot connect, check the socket path, runtime service, access permissions, and kubelet endpoint configuration. If it connects but results differ from expectations, confirm that you are querying the correct node and runtime, then check ImageService, kubelet and runtime logs, and Pod events. crictl is a diagnostic client; it does not repair kubelet settings or reconcile Kubernetes objects. Follow the provider's recovery procedure before restarting a production runtime or widening socket permissions.
Sources
[Kubernetes: Container Runtime Interface (CRI)](https://kubernetes.io/docs/concepts/containers/cri/)
[Kubernetes: Container Runtimes](https://kubernetes.io/docs/setup/production-environment/container-runtimes/)
[Kubernetes: Debugging Kubernetes nodes with crictl](https://kubernetes.io/docs/tasks/debug/debug-cluster/crictl/)
[Kubernetes: Check whether dockershim removal affects you](https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/check-if-dockershim-removal-affects-you/)
[Kubernetes: Network plugins and CNI](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/)