Skip to content
tezvyn:

Node, Pod, and Container relationship

Source: interviewEasyHow cards are made

Summary

the core scheduling unit hierarchy.

Key points

a Node is a machine, a Pod is the smallest deployable unit wrapping one or more containers that share network and storage, and the Pod abstraction enables co-location and lifecycle management.

What's really being asked

This checks whether you understand the layering of compute units and the rationale for the Pod abstraction.

The full answer

A Node is a worker machine in the cluster, virtual or physical, running a kubelet and a container runtime. A Container is a running image instance. A Pod sits between them: it is the smallest deployable and schedulable object, wrapping one or more containers that are tightly coupled. Containers in a Pod share a network namespace, so they have one IP and can talk over localhost, and they can share storage volumes. Kubernetes schedules Pods onto Nodes, not bare containers, because the Pod gives a stable unit for networking, co-locating sidecars or init containers, sharing data, and managing a shared lifecycle. Running containers directly would lose this grouping, the shared IP, and the consistent unit that controllers and the scheduler operate on. Most Pods run a single container; multi-container Pods exist for helper patterns like a sidecar proxy.

The mistakes people make

Saying a Pod is just another word for a container. Claiming every Pod has many containers. Ignoring the shared network namespace and volumes. Thinking Nodes schedule individual containers.

What usually comes next

What is the pause container? When do you use multiple containers in a Pod? How do containers in a Pod communicate? What is an init container?

A concrete example

A web app Pod runs the app container plus a sidecar that ships logs. Both share the Pod's IP and a shared emptyDir volume where the app writes logs and the sidecar reads them. Kubernetes schedules this whole Pod onto a Node; the two containers always live and die together on the same machine, which would be awkward to coordinate if Kubernetes scheduled containers individually.

Interview question

Why does Kubernetes schedule Pods rather than individual containers onto Nodes?

  • a.Pods make images smaller
  • b.A Node can only run one container at a time
  • c.Containers cannot run on Linux without a Pod wrapper
  • d.A Pod groups tightly coupled containers that share network and storage as one schedulable unitCorrect
Why?

The Pod is the unit that bundles a shared IP, volumes, and lifecycle for co-located containers. Containers can run without Kubernetes (C), and a Node runs many Pods (B).

Just read this? Test yourself on what you have been reading.

Read the original → kubernetes.io

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on kubernetes — each one lists the topics its interview covers.

See open roles