Most people come to Kubernetes already knowing a bit of Docker, and then it throws a pile of new words at them: Pods, namespaces, kubelet, container runtime, restart policies. The question I had at the start was simple. If containers already exist, why does Kubernetes need Pods at all?

The answer became obvious once I stopped treating Kubernetes as magic and looked at what happens on the node underneath. That’s what this post and the video do.

A container is just a process

A container is not a small virtual machine. It’s an ordinary Linux process running on the host’s kernel, with two kernel features wrapped around it.

Namespaces control what the process can see. It gets its own view of process IDs, network interfaces, the file system, hostnames and users, so it looks like it’s alone on the machine. cgroups control how much it can use, limiting CPU and memory so one container can’t starve the others.

You can check this yourself. Start a container with docker run nginx, then look at the host’s process list, and the NGINX processes are right there. In the video I run lsns under watch to list namespaces live. You can see new namespaces appear when a container starts and disappear when it stops. That was the moment containers finally clicked for me.

So what’s a Pod?

In Kubernetes, the smallest thing you deploy is a Pod, not a container. A Pod is a wrapper around one or more containers that should always run together on the same node.

Most Pods have one main container. Sometimes you add helper containers alongside it, usually called sidecars, such as a log shipper, a monitoring agent or a service mesh proxy. Containers in the same Pod share a network namespace, so they have the same IP address and talk to each other over localhost. They can also share storage volumes. That’s exactly why the Pod exists: it lets tightly coupled containers share a network and storage while still being separate processes. (Under the hood, a tiny “pause” container holds the shared network namespace that the others join.)

Imperative vs declarative

There are two ways to tell Kubernetes what to run. The imperative way is a direct command:

kubectl run nginx --image=nginx

It’s quick and great for testing and debugging. The declarative way is to describe what you want in a YAML file and apply it:

kubectl apply -f pod.yaml

In production you almost always use the declarative approach. The YAML files live in Git, so they’re reviewed, versioned and reproducible, and the repository becomes the source of truth for what should be running. That’s also the foundation GitOps tools like ArgoCD build on.

Restart policies and self-healing

Kubernetes constantly compares what’s running with what you asked for, and works to close the gap. For a single Pod, the restartPolicy decides what happens when a container exits.

With restartPolicy: Always (the default), the kubelet restarts the container whenever it stops, whether it crashed or was killed. That’s the “self-healing” behaviour people talk about. With restartPolicy: Never, a container that exits stays stopped and the Pod ends up in a Failed or Completed state. There’s also OnFailure, which only restarts after a non-zero exit, and is commonly used for Jobs. In the video I kill the container under both policies so you can see the difference directly.

Looking at the node itself

The part I found most useful was skipping kubectl for a moment and SSHing into the worker node to see what’s really there.

Modern clusters don’t talk to Docker at all. They use a container runtime like containerd or CRI-O, which pulls images, creates containers and manages their lifecycle on the node. With containerd, you can inspect Kubernetes containers directly with ctr (they live in the k8s.io namespace), or with crictl. Seeing the Pod’s containers as plain processes on the node takes away a lot of the mystery.

What happens when you create a Pod

Put together, the flow is:

  • You send the request with kubectl, and the API server validates it and stores it in etcd.
  • The scheduler picks a node with enough resources and assigns the Pod to it.
  • The kubelet on that node sees the new assignment and asks the container runtime to start it.
  • The runtime pulls the image, sets up the namespaces and cgroups, and starts the container processes.

Once you can picture this, most Kubernetes troubleshooting becomes a question of which step failed. A Pod stuck in Pending is usually a scheduling problem. An ImagePullBackOff is the runtime failing to pull the image. A CrashLoopBackOff is the container starting and then exiting.

Why the basics come first

People who struggle with Kubernetes usually came to it too early, before Linux, networking and Docker felt comfortable, or they memorised YAML without understanding what it does. If you understand processes, namespaces and runtimes, Kubernetes stops looking random.

Watch the walkthrough

The video covers containers as processes, namespaces and cgroups, Pods and sidecars, imperative and declarative commands, restart policies, containerd and ctr, and the Pod creation flow, with demos run directly on the nodes.

Next steps

With Pods clear, move on to the objects that manage them: Deployments and ReplicaSets, Services, Ingress, ConfigMaps and Secrets, Persistent Volumes and the Horizontal Pod Autoscaler. Keep the habit of checking what’s happening on the node, too, because it’ll help you debug all of them. For the cluster-level picture, read Kubernetes architecture explained, and to get a cheap cluster to practise on, K3s on AWS EC2.

Madhukar Reddy

DevOps engineer focused on AWS, Docker, Kubernetes, cloud infrastructure, and cyber security. Shares practical cloud and DevOps content based on hands-on deployments, infrastructure troubleshooting, and real-world projects.

$ This blog is currently running on AWS EC2 using Docker-based deployment.

Leave a response