Foundations: web, servers, containersLesson 6 of 13
From One Server to Containers
Build it up one step at a time: how one physical server is split into virtual machines, and how containers run on top of them. This is the background you need to read a Kubernetes node's CPU and memory graphs and its specs.
Unit of executionProgram
Operating systemOne per server
Resources—
RequestResponse / reportAppears in a later step
What you will learn
- What CPU, memory, disk and network each do
- Too little CPU means slow, too little memory means killed
- Each virtual machine has a whole OS of its own
- A container is an isolated process sharing the kernel
- On-premises vs public vs private cloud
Physical server vs VM vs container
| Type | What it has on its own | Traits |
|---|---|---|
| Physical server | All hardware and the OS | One program per server leaves resources unused |
| Virtual machine | Its own OS | The hypervisor allocates and isolates resources. Heavy, since it carries a whole OS |
| Container | Only programs and libraries | Shares the kernel. Starts in seconds, and many more fit on one server |
Where a container's source (the image) comes from is the next lesson. How a container actually starts on a node is in How a Pod Starts.
Try it yourself
nproc; free -h; df -h # CPU, memory, disk (on a Linux server)
ps -ef | head # Processes and their PIDs
kubectl get nodes -o custom-columns=NAME:.metadata.name,CPU:.status.capacity.cpu,MEMORY:.status.capacity.memory # Node size
kubectl top nodes # CPU and memory use per node (needs metrics-server)
kubectl get pod <pod> -o jsonpath='{.status.containerStatuses[*].lastState.terminated.reason}' # OOMKilled after a memory limit?
Check yourself
Further reading: Containers (Kubernetes docs) · Nodes · Resource Management for Pods and Containers