From point A to point B
Point A: you know Kubernetes is everywhere, but you're not yet sure what problem it solves or what pieces it's made of. Point B: by the end of this chapter you'll be able to explain what a container is, why you need an orchestrator, how a cluster is organized, and what role each runtime plays.
This is the foundation of the Kubernetes Fundamentals domain, which makes up 44% of the KCNA exam. It's worth mastering.
Containers: the end of "it works on my machine"
Before containers, every application depended on specific libraries, versions and operating systems. One combination worked on the dev team's laptop and failed in production. That web of incompatibilities came to be called the matrix from hell.
A container packages the application with everything it needs to run. The same package runs the same way on your laptop, on the test server and in production. That's its big advantage.
Virtual machine vs. container
A virtual machine carries its own full operating system on top of a hypervisor. A container, on the other hand, shares the kernel of the host operating system and only isolates processes, networking and the file system.
Virtual machines virtualize hardware; containers isolate processes on a shared kernel. Diagram: The House of Routing.
- Size: a VM takes up gigabytes; a container, megabytes.
- Startup: a VM takes minutes; a container, seconds.
- Isolation: the VM isolates more, because it doesn't share a kernel. The container wins on lightness.
Sharing the kernel has consequences
Because the kernel is shared, you can run a Fedora- or Red Hat-based container on an Ubuntu server: they all use the Linux kernel. What changes are each distribution's libraries and tools, which travel inside the image.
Docker doesn't virtualize the operating system: it packages and distributes applications. In its early days it relied on LXC, Linux Containers; today it delegates execution to containerd and runc, which you'll see later.
Image vs. container
An image is the template: a set of read-only layers with the application and its dependencies. A container is a running instance of that image, with its own layer it can write to. Think of a blueprint and the buildings you construct from it.
One image, many isolated containers. Images are stored and shared in a registry such as Docker Hub. Diagram: The House of Routing.
Your first Docker commands
Docker is available for Linux, Windows and macOS. On Ubuntu, the most direct way to install it for practice is the distribution's package:
sudo apt update
sudo apt install -y docker.io
sudo docker run hello-world
If you see the message Hello from Docker!, the engine pulled the image, created a container and ran it. Now start a web server and see what's running:
# nginx in the background, publishing host port 8080
sudo docker run -d --name web -p 8080:80 nginx:alpine
sudo docker ps # running containers
sudo docker images # downloaded images
curl -I http://localhost:8080
sudo docker rm -f web # stop and remove it
Why orchestrate containers?
With one container on one server, everything is manual and it works. With hundreds of containers spread across dozens of servers, hard questions show up. Where do I place each one? What happens if a node goes down? How do I scale when traffic rises?
Container orchestration answers those questions automatically. You declare the desired state, and the orchestrator makes sure it holds.
If node 4 goes down, the orchestrator reschedules its replica on another node without you stepping in. Diagram: The House of Routing.
There were several alternatives, such as Docker Swarm or Apache Mesos. Kubernetes became the de facto standard: it's more demanding to set up, but it offers load balancing, self-healing, scaling and, above all, a declarative model in YAML files.
# deployment.yaml · desired state: 3 nginx replicas
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:1.27-alpine
ports:
- containerPort: 80
You don't tell Kubernetes "start three containers here and there." You tell it "I want three replicas," and it decides where and how. If a replica dies, it creates another one.
The architecture of a cluster
A Kubernetes cluster has two kinds of machines. The control plane makes the decisions. The worker nodes run the applications. In older material you'll see the names master and minion; today the current terms are used.
Everything goes through kube-apiserver. Diagram: The House of Routing, based on the official Kubernetes documentation.
| Component | Where it lives | What it does |
|---|---|---|
kube-apiserver | Control plane | It's the cluster's front door. Every component, and you with kubectl, talks to it. |
etcd | Control plane | Distributed key-value database where the cluster state is stored. It keeps consistency across multiple control plane nodes using the Raft consensus algorithm. |
kube-scheduler | Control plane | Decides which node each new pod goes to. It only assigns: it doesn't run anything. |
kube-controller-manager | Control plane | Runs the controllers that compare the actual state with the desired state and act: for example, they detect a node that's down or a missing replica. It's the brain of orchestration. |
cloud-controller-manager | Control plane (optional) | Connects the cluster to a cloud provider's API: load balancers, routes, disks. |
kubelet | Every node | Agent that receives instructions from the API server and makes sure each pod's containers are running as expected. |
kube-proxy | Every node | Programs the network rules that make Services work. |
| Container runtime | Every node | The software that actually runs the containers, such as containerd or CRI-O. |
kubectl, your command line
kubectl is the official tool for managing the cluster. It talks to kube-apiserver and shows you, or changes, the state of nodes, pods and other resources.
kubectl cluster-info # where the control plane is
kubectl get nodes # nodes and their status
kubectl run hello --image=nginx:alpine
kubectl get pods -o wide # which node each pod landed on
CRI and OCI: how Kubernetes talks to runtimes
At first, Kubernetes only knew how to work with Docker. To open up to other runtimes, it created the Container Runtime Interface (CRI): an API that defines how the kubelet asks a runtime to pull images and start containers. The communication uses gRPC.
The kubelet speaks CRI; the runtime starts containers with an OCI runtime such as runc. Diagram: The House of Routing.
The case of Docker and dockershim
Docker Engine doesn't implement CRI. To keep supporting it, Kubernetes maintained a bridge called dockershim. It was a temporary solution, and it was removed completely in Kubernetes v1.24.
Does that mean Docker images stopped working? No. The images you build with Docker follow the Open Container Initiative (OCI) standard, and any CRI-compatible runtime runs them without a problem.
The two OCI standards
- image-spec: defines how an image is built and packaged.
- runtime-spec: defines how a runtime must behave when it runs a container.
Docker is much more than a runtime: it includes a CLI, an API, build, volumes, authentication and security. Under the hood, it delegates execution to containerd. Kubernetes doesn't need that whole bundle, so it can use containerd directly, without installing Docker.
containerd is an independent project and has been a CNCF graduated project since February 2019.
Three CLIs for the same world: ctr, nerdctl and crictl
If a node has no Docker, what do you use to inspect containers? There are three tools, each with its own purpose.
ctr | nerdctl | crictl | |
|---|---|---|---|
| Purpose | Debugging | General use | Debugging |
| Project | containerd | containerd | Kubernetes |
| Works with | containerd | containerd | Any CRI-compatible runtime |
| Feels like Docker | No | Yes | Fairly |
ctr: ships with containerd
It's installed along with containerd. It isn't very user-friendly and it's meant for support and debugging, not for managing container environments day to day.
sudo ctr images pull docker.io/library/redis:alpine
sudo ctr run -d docker.io/library/redis:alpine redis
sudo ctr containers list
nerdctl: the Docker experience on containerd
It offers a CLI that's almost identical to Docker's, supports Docker Compose and gives you access to newer containerd features: lazy pulling of images, encrypted images, P2P distribution, and image signing and verification.
nerdctl run -d --name my-app redis:alpine
nerdctl run -d --name my-web -p 8080:80 nginx:alpine
nerdctl ps
crictl: the kubelet's view
It's maintained by the Kubernetes community and installed separately. It speaks CRI, so it works with any compatible runtime. Use it to inspect and debug; the kubelet creates pods and containers, not you.
sudo crictl pull busybox
sudo crictl images
sudo crictl pods # pods on the node
sudo crictl ps -a # containers, including stopped ones
sudo crictl logs <container-id>
sudo crictl exec -it <container-id> ls
If the node has more than one runtime, tell crictl which one to work with. You can do it with a flag, an environment variable or the /etc/crictl.yaml file:
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock ps
export CONTAINER_RUNTIME_ENDPOINT=unix:///run/containerd/containerd.sock
KCNA-style challenge
Answer before you open the solution. Getting it wrong here is the cheapest way to learn.
1. Which component decides which node a new pod runs on?
kube-scheduler. It assigns the pod to a node; the one that then starts it is that node's kubelet, through the runtime.
2. Kubernetes v1.24 removed dockershim. Can you still use images built with Docker?
Yes. The images follow the OCI standard, and any CRI-compatible runtime, such as containerd or CRI-O, runs them.
3. Where does Kubernetes store the cluster state?
In etcd, a distributed key-value database. Only kube-apiserver reads from and writes to it.
4. You need to debug the containers on a node that uses CRI-O. Which tool do you pick?
crictl. ctr and nerdctl belong to containerd; crictl works with any CRI-compatible runtime.
Key takeaways
- A container packages the application and shares the host's kernel; that's why it's lightweight and portable.
- The image is the template; the container, a running instance.
- Kubernetes orchestrates: you declare the desired state and it maintains it.
- The control plane decides (kube-apiserver, etcd, kube-scheduler, kube-controller-manager); the nodes execute (kubelet, kube-proxy, runtime).
- The kubelet talks to the runtime through CRI; images and runtimes follow the OCI standards.
- To debug a Kubernetes node, your tool is
crictl.
In the next chapter we move from architecture to resources: pods, ReplicaSets, Deployments and Services.
Official resources
- Kubernetes · Overviewkubernetes.io
- Kubernetes Componentskubernetes.io
- Container Runtime Interface (CRI)kubernetes.io
- Container Runtimeskubernetes.io
- Dockershim Removal FAQkubernetes.io · blog
- Debugging Kubernetes nodes with crictlkubernetes.io
- kubectl referencekubernetes.io
- Kubernetes and Cloud Native Associate (KCNA)cncf.io
- CNCF announces containerd graduationcncf.io
- containerdcontainerd.io
- Open Container Initiativeopencontainers.org
Sources and credits. This chapter is based on Jesús Espinoza's study notes from the KodeKloud KCNA course (January 2026). Text written with AI assistance; original diagrams by The House of Routing. Technical details were checked against the official Kubernetes and CNCF documentation.