KUBERNETES · KCNA · CHAPTER 1

Kubernetes Fundamentals

Containers, orchestration, cluster architecture and runtimes: the foundation of the KCNA exam.

8 min readKCNA domain: Kubernetes Fundamentals (44%)Level: beginner

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 vs containers Each virtual machine carries its own guest OS on top of a hypervisor; containers share the kernel of the host OS through a container runtime. VIRTUAL MACHINES CONTAINERS Hardware Host OS Hypervisor Guest OS Libs App A Guest OS Libs App B Guest OS Libs App C GB per VM · boots in minutes each VM carries a full OS Hardware Host OS · shared kernel Container runtime Libs App A Libs App B Libs App C MB per container · starts in seconds all containers share one kernel

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.

Watch out for Windows. A Windows container doesn't run on a Linux kernel. To run it, you need a Windows Server host.

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.

Image vs container One read-only image works as a template; docker run creates several running containers from it, each with its own writable layer. IMAGE · TEMPLATE CONTAINERS · RUNNING App code Dependencies Base image (alpine) nginx:alpine read-only layers · stored in a registry docker run writable layer web-1 writable layer web-2 writable layer web-3 same image, three isolated processes

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
Exam tip. The KCNA doesn't ask you to master Docker, but it does expect you to tell image, container and registry apart, and to know that Kubernetes doesn't run containers by itself: it asks a runtime to do 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.

Container orchestration Without an orchestrator, every host is managed by hand. With an orchestrator, you declare the desired state once and it places, restarts and scales containers across all the nodes. orchestrator desired state: web × 5 · db × 1 NODE 1 web web NODE 2 web db NODE 3 web web rescheduled NODE 4 · DOWN its web replica is rescheduled on node 3 You declare the what; the orchestrator works out the where and the how.

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.

Kubernetes architecture kubectl talks to kube-apiserver in the control plane, which also hosts etcd, kube-scheduler and kube-controller-manager. On every worker node, kubelet receives instructions from the API server and asks the container runtime to run the pods; kube-proxy handles Service networking. kubectl you / CI CONTROL PLANE kube-apiserver etcd kube-scheduler kube-controller-manager cloud-controller-manager optional · only in a cloud provider decides: what runs, where, how many WORKER NODE 1 kubelet kube-proxy container runtime pod pod pod WORKER NODE 2 kubelet kube-proxy container runtime pod pod run the workloads Every component talks to kube-apiserver; only the API server reads and writes etcd.

Everything goes through kube-apiserver. Diagram: The House of Routing, based on the official Kubernetes documentation.

ComponentWhere it livesWhat it does
kube-apiserverControl planeIt's the cluster's front door. Every component, and you with kubectl, talks to it.
etcdControl planeDistributed key-value database where the cluster state is stored. It keeps consistency across multiple control plane nodes using the Raft consensus algorithm.
kube-schedulerControl planeDecides which node each new pod goes to. It only assigns: it doesn't run anything.
kube-controller-managerControl planeRuns 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-managerControl plane (optional)Connects the cluster to a cloud provider's API: load balancers, routes, disks.
kubeletEvery nodeAgent that receives instructions from the API server and makes sure each pod's containers are running as expected.
kube-proxyEvery nodePrograms the network rules that make Services work.
Container runtimeEvery nodeThe 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.

CRI and OCI kubelet speaks gRPC through the Container Runtime Interface to a CRI runtime such as containerd or CRI-O. Those runtimes start containers through an OCI runtime such as runc and pull images that follow the OCI image spec. dockershim, the old bridge to Docker Engine, was removed in Kubernetes v1.24. kubelet CRI · gRPC API containerd CRI-O CRI-compatible runtimes OCI runtime · runc OCI RUNTIME-SPEC container container container running containers registry OCI IMAGE-SPEC Docker Hub, GHCR, ECR… dockershim removed in v1.24 (bridge to Docker Engine)

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

  1. image-spec: defines how an image is built and packaged.
  2. 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.

ctrnerdctlcrictl
PurposeDebuggingGeneral useDebugging
ProjectcontainerdcontainerdKubernetes
Works withcontainerdcontainerdAny CRI-compatible runtime
Feels like DockerNoYesFairly

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

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.

Navigate