Containers
- Share the same OS (Kernel)
- Docker has the additional software in the OS shared
- Package the containers applications and ship them
Hardware Infrastructure -> OS -> Docker -> Multiple containers (Libs + Dependencies + Applications)
Containerization
Docker Repository store images that we can use a simple docker run redis to run the container.
Container vs Image
- Containers used the image (template) to run.
- Docker image can run in any host that is docker installed.
Container Ochestration
- Docker Swarm
- MESOS
- Kubernetes
Kubernetes is a container orchestration technology that manages and deploys thousands of containers in a cluster.
Kubernetes Architecture
- Nodes -> physical or virtual machine that provides the underlying compute resources (CPU, memory, storage, and networking) required to execute your comtainerized applications.
- Cluster -> multiple nodes groups.
Workers Nodes Vs Master Node
- Worker nodes -> These machines do the heavy lifting by running the application workloads grouped inside pods.
- Master node -> These machines run the essencial cluster management services like the API Server, scheduler, etcd, that oversee the entire cluster.
Components
Master Nodes
- kube-apiserver: The "front door" and entry point for all administrative traffic. It exposes the HTTP API, validate requests, and servers as the sole communication hub between all other components.
- etcd: A lighweight, highly available, distributed key-value store. It acts as the database and single "source of truth", safely holding all cluster configuration and state data.
- kube-scheduler: The placement engine. It watches for newly created pods that lack an assigned host machine and matches them to the most optimal worker node based on resource constraints, policies and labels.
- kube-controller-manager: The reconcilliation engine. It runs background control loops (like the node controller and job controller) to continuously monitor the cluster's actual state and bring in line with the desired state if an outage occurs.
- cloud-controller-manager: An optional extension that links yout local Kubernetes cluster info a cloud provider's API. It handles provider-specific tasks such as provisioning managed load balancers or storage volumes.
Workers Nodes
- kubelet: The node agent or "site manager". It takes direct instructions from the master's API Server, processes pod specifications (
PodSpecs), and communicates with the container runtime to guarantee that all requested containers are healthy and running. - kube-proxy: The network proxy running on each node. It mantains precise network routing configurations and IP table rules, faciliting seamless internal and external traffic delivery to target pods.
- Container Runtime: The underlying engine executing inside the pods. Kubernetes supports standardized container runtimes conforming to the Container Runtime Interface (CRI), such as containerd or CRI-O.
Docker vs ContainerD
Container Runtime Interface (CRI) is a standardized plugin API layer that allows the Kubernetes node agent (kubelet) to communicate with different container runtimes without needing to recompile cluster components. It acts as a universal translator.
[ Kubelet ]
│ (via gRPC / CRI API)
▼
[ CRI Runtime Daemon ] (e.g., containerd, CRI-O)
│ (via OCI Specification)
▼
[ Low-Level OCI Runtime ] (e.g., runc, crun)
│
▼
[ Linux Kernel ] (Namespaces, cgroups)
Open Container Initiative (OCI) is a Linux Foundation project to create open, vendor-neural standards for software containers. The OCI achieves this by governing three core technical specifications: image-spec, runtime-spec and distribution-spec.
Command-line tools
ctr is a low-level, built-in tool for containerd developers, nerdctl is a user-friendly, Docker-compatible alternative for everyday container management, and crictl is a Kubernetes-maintained tool specifically built for inspecting and debugging Container Runtime Interface (CRI) environments.
| ctr | nerdctl | crictl | |
|---|---|---|---|
| Purpose | Debugging | General Purpose | Debugging |
| Community | ContainerD | ContainerD | Kubernetes |
| Works With | ContainerD | ContainerD | All CRI-Compatible Runtimes |