blog
  • Blogs
    • Medium Articles
      • Linux
        • 40 Powerful Linux Networking Commands You Must Know.
        • These (Linux) VI Editor Shortcuts You Must Know
        • Bash/Linux Interview Questions for DevOps Engineers
        • Page 1
      • Git
        • 40 Powerful Git Commands Every Developer Should Know
        • 10 Git Best Practices That Every Developer Must Know
      • DevOps/SRE Interview Questions and Answers
        • Top DevOps/SRE Interview Questions and Answers on AWS VPC
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Terraform Best Practices
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Kubernetes Best Practices
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Dockerfiles
        • Top 10 Common DevOps/SRE Interview Questions and Answers on Grafana
      • Installation
        • Docker Installation on Ubuntu 20/22
        • Install WireGuard VPN on Docker Compose
        • Install Redis on Docker Compose
        • Gravitee Docker Compose
      • Kubernetes Series 2025
        • Understanding Kubernetes: Part 1 -Control Plane
        • Understanding Kubernetes: Part 2 -Worker Node
        • Understanding Kubernetes: Part 3 -Pod
        • Understanding Kubernetes: Part 4-ReplicaSets
        • Understanding Kubernetes: Part 5 -Deployment
        • Understanding Kubernetes: Part 6 -DaemonSets
        • Understanding Kubernetes: Part 7 -StatefulSet
        • Understanding Kubernetes: Part 8 -ConfigMap
        • Understanding Kubernetes: Part 9 -Kubernetes Secret
        • Understanding Kubernetes: Part 10 -StorageClass
        • Understanding Kubernetes: Part 11 -Persistent Volume (PV)
        • Understanding Kubernetes: Part 12 -Persistent Volume Claim (PVC)
        • Understanding Kubernetes: Part 13 -Services
        • Understanding Kubernetes: Part 14 -ClusterIP Service
        • Understanding Kubernetes: Part 15 -NodePort Service
        • Understanding Kubernetes: Part 16 -Load Balancer Service
        • Understanding Kubernetes: Part 17 -Ingress
        • Understanding Kubernetes: Part 18 -Ingress Controller
        • Understanding Kubernetes: Part 19 -Headless Service
        • Understanding Kubernetes: Part 20-Network Policy
        • Understanding Kubernetes: Part 21 -CNI
        • Understanding Kubernetes: Part 22 Kubernetes Resource Requests & Limits
        • Understanding Kubernetes: Part 23 Node Selector
        • Understanding Kubernetes: Part 24 Taints and Tolerations
        • Understanding Kubernetes: Part 25 Affinity and Anti-Affinity
        • Understanding Kubernetes: Part 26 Preemption and Priority
        • Understanding Kubernetes: Part 27 Role and RoleBinding
        • Understanding Kubernetes: Part 28 ClusterRole and ClusterRoleBinding
        • Understanding Kubernetes: Part 29 Service Account
        • Understanding Kubernetes: Part 30 Horizontal Pod Autoscaler (HPA)
        • Understanding Kubernetes: Part 31 Vertical Pod Autoscaler (VPA)
        • Understanding Kubernetes: Part 33 Startup Probe
        • Understanding Kubernetes: Part 34 Liveness Probe
        • Understanding Kubernetes: Part 35 Readiness Probe
        • Understanding Kubernetes: Part 36 Container Network Interface (CNI)
        • Understanding Kubernetes: Part 37 Container Runtime Interface (CRI)
        • Understanding Kubernetes: Part 38 Container Storage Interface (CSI)
      • Cloudflare
        • Cloudflare Tunnel for Secure HTTP Routing
      • Nginx
        • Nginx use cases that every engineer must know
Powered by GitBook
On this page
  1. Blogs
  2. Medium Articles
  3. Kubernetes Series 2025

Understanding Kubernetes: Part 37 Container Runtime Interface (CRI)

PreviousUnderstanding Kubernetes: Part 36 Container Network Interface (CNI)NextUnderstanding Kubernetes: Part 38 Container Storage Interface (CSI)

Last updated 2 months ago


📢 If you’ve been following our Kubernetes series 2025, welcome back! For new readers, check out

Container Runtime Interface (CRI) in Kubernetes

The Container Runtime Interface (CRI) is a plugin interface in Kubernetes that allows the kubelet to use different container runtimes for managing pods and containers. Kubernetes does not run containers directly; instead, it communicates with a container runtime via CRI to perform operations like pulling images, starting/stopping containers, and managing container networking.

Unlike Docker, which was directly integrated into Kubernetes in earlier versions, Kubernetes now interacts with container runtimes like containerd and CRI-O through the CRI.

Why is CRI Important?

  1. Pluggability — Kubernetes can work with different container runtimes without modifying the kubelet.

  2. Standardization — The CRI defines a standard API that all runtimes must implement, ensuring compatibility.

  3. Performance — CRI-optimized runtimes (e.g., containerd, CRI-O) are lightweight and efficient compared to Docker.


Types of CRI Implementations

Kubernetes supports multiple CRI implementations, including:

  1. containerd — A lightweight, industry-standard container runtime used by Kubernetes.

  2. CRI-O — A Kubernetes-specific container runtime designed for Open Container Initiative (OCI) compatibility.

  3. Docker (Legacy) — Older versions of Kubernetes supported Docker directly, but now Docker operates through dockershim (deprecated in Kubernetes 1.24).


How CRI Works in Kubernetes

The Kubernetes kubelet interacts with a container runtime via CRI using gRPC API calls. The CRI consists of two major services:

  1. Runtime Service — Handles container lifecycle operations like creating, starting, stopping, and deleting containers.

  2. Image Service — Manages container images, including pulling, listing, and removing images.

When a pod is scheduled, the kubelet does the following:

  1. Calls the CRI API to pull the container image if not already available.

  2. Requests the CRI to create and start containers within the pod.

  3. Monitors container health via periodic CRI API calls.


Capabilities of CRI

  • Container Lifecycle Management — CRI enables Kubernetes to start, stop, and restart containers.

  • Image Management — Supports pulling, caching, and removing container images.

  • Networking & Storage — Ensures integration with Kubernetes networking (CNI) and storage (CSI) plugins.

  • Customizability — Kubernetes can switch between different CRI implementations based on requirements.


Example: Checking CRI Health

To check if CRI is functioning correctly, you can use CLI tools like crictl (for both containerd and CRI-O).

Check Container Status (For containerd & CRI-O)

crictl ps

This lists all running containers managed by the CRI.

Check CRI Runtime Info

crictl info

This provides detailed information about the container runtime and its configuration.

Check Image List

crictl images

This displays all available container images managed by the CRI.


Real-World Usage of CRI in Kubernetes

In my previous role as a DevOps Engineer, I managed Kubernetes clusters running on containerd. We ensured that the CRI was functioning correctly by:

  • Configuring health checks for the CRI to ensure stable cluster operations.

  • Monitoring runtime performance to detect issues like slow image pulls or container failures.

  • Switching from Docker to containerd to optimize resource utilization and improve cluster efficiency.

By leveraging CRI, we were able to enhance Kubernetes performance and reduce dependency on Docker, ensuring a more scalable and production-ready environment.


Example: YAML Configuration for a Kubernetes Pod Using CRI

Containerd Example

apiVersion: v1
kind: Pod
metadata:
  name: containerd-test
spec:
  containers:
    - name: test-container
      image: busybox
      command: ["/bin/sh", "-c", "echo Hello from containerd; sleep 3600"]

This pod runs on a Kubernetes cluster using containerd.

CRI-O Example

apiVersion: v1
kind: Pod
metadata:
  name: crio-test
spec:
  containers:
    - name: test-container
      image: busybox
      command: ["/bin/sh", "-c", "echo Hello from CRI-O; sleep 3600"]

This pod runs on a Kubernetes cluster using CRI-O.


Key Takeaways

  • CRI allows Kubernetes to interact with container runtimes in a standardized way.

  • Popular CRI implementations include containerd and CRI-O.

  • Kubelet communicates with CRI via gRPC to manage container lifecycles and images.

  • You can check CRI health using crictl commands.

  • Switching to containerd or CRI-O improves Kubernetes performance and reduces resource overhead.

🚀 Ready to Master Kubernetes?

Take your Kubernetes journey to the next level with the Master Kubernetes: Zero to Hero course! 🌟 Whether you’re a beginner or aiming to sharpen your skills, this hands-on course covers:

✅ Kubernetes Basics — Grasp essential concepts like nodes, pods, and services. ✅ Advanced Scaling — Learn HPA, VPA, and resource optimization. ✅ Monitoring Tools — Master Prometheus, Grafana, and AlertManager. ✅ Real-World Scenarios — Build production-ready Kubernetes setups.

🔥 Flash Sale: Buy Kubernetes Course, Get Terraform FREE! Limited Time Offer!

Don’t miss your chance to become a Kubernetes expert! 💻✨

🚀 Master Terraform: Infrastructure as Code

Apply Code DEVOPS20 for 20% OFF!

🔥 Start `Learning Now: [Join the Master Kubernetes Course + FREE Access to Terraform Course]()

🚀 Stay ahead in DevOps and SRE! 🔔 and never miss a beat on Kubernetes and more. 🌟

🔥 Start Learning Now:

https://cloudops0.gumroad.com/l/k8s
Subscribe now
Join the Master Terraform Course
Part 36 Container Network Interface (CNI)