Read Pod Sandboxes and Containers through CRI · containerd
Investigate the runtime from the interface used by kubelet.
Learn with progress and quizzesFirst, understand the concepts.
CRI API
kubelet sends requests through CRI. A working ctr connection does not prove the CRI plugin is healthy; check that interface separately.
Sandbox and container
crictl pods lists Pod sandboxes, while ps lists containers. Relate runtime observations to Kubernetes Pod status without treating them as identical objects.
Explicit endpoint
Specify the actual endpoint rather than guessing sockets. Paths vary by distribution, and managed environments may restrict node access.
Why it matters
Distinguishing a Kubernetes Pod from a CRI Pod Sandbox helps explain container restarts within a Pod. The sandbox supplies execution context such as networking.
Work through the reasoning
Distinguish list units
crictl pods lists sandboxes; ps lists containers. Include stopped instances with ps -a and connect IDs and attempts rather than relying only on Pod names.
Match Kubernetes observations
Match the Pod’s node and namespace to that node’s CRI view. Kubernetes metadata may appear in CRI labels, but ctr namespaces are not Kubernetes namespaces.
Learn by doing.
Use a personal Linux practice VM with containerd, runc, ctr, and sudo access. The nerdctl lab also needs nerdctl; the CRI lab needs crictl and a practice node with CRI enabled. Examples assume /run/containerd/containerd.sock; check the actual socket in other environments.
Run these read-only commands only on a personal Kubernetes node with CRI enabled. They assume the default containerd socket. A plain VM without CRI configured is not necessarily broken when these calls fail.
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock info
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock pods
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock ps -a
sudo ctr --namespace k8s.io containers lsHow to check your result
Distinguish RuntimeReady from NetworkReady and explain the difference between pods and ps -a. For unavailable CRI, inspect endpoint, plugin enablement, and compatibility. Do not directly stop or remove production Pod containers.
Apply what you learned
The same Pod name has a stopped container ID and a new running ID. What should you check?
Reveal the reasoning after trying
Compare sandbox and Pod identity, container name, attempt, and termination reason. Determine whether restart created a new instance. Do not directly delete Kubernetes-managed containers just to investigate.
Ready to check your understanding?
What does crictl pods list?
- Docker image tags
- Pod sandboxes
- Every Kubernetes Service
- Git branches
Reveal the reasoning after trying
Pod sandboxes
crictl pods lists runtime Pod sandboxes; crictl ps lists containers.
Official documentation · Read Pod Sandboxes and Containers through CRI