Kubernetes
Kubernetes is not a hypervisor: learn how it schedules and maintains container workloads on physical or virtual nodes.
Kubernetes (often shortened to K8s) manages containerized workloads across a group of machines called a cluster. It is not a hypervisor: a cluster node can be a physical machine or a VM, and Kubernetes works above that machine layer. You describe the state you want—such as two copies of a web app—and Kubernetes continually works to keep the cluster close to that state.
Picture it: A container is one food truck; Kubernetes is the dispatcher coordinating a whole fleet—where each truck runs, how customers find it, and what happens if one breaks down.
Cluster: control plane and worker nodes
A Kubernetes cluster has a control plane and worker nodes. The control plane stores the desired configuration, schedules workloads, and reports cluster state. Worker nodes run the workloads and provide the compute resources they need.
The control plane’s scheduler chooses a suitable worker for each new workload based on available resources and rules. Controllers compare the current state with the desired state and make changes when they differ. This is the reconciliation loop: declare the goal, then let Kubernetes keep checking and correcting the cluster.
Pods, Deployments, and Services
A Pod is Kubernetes’ smallest deployable unit. It contains one or more closely related containers that share networking and can share storage. Most application containers run in a Pod created and managed by a higher-level resource rather than being created by hand.
A Deployment describes a set of interchangeable Pod replicas and how updates should roll out. If a Pod stops running, its controller can create a replacement to move the cluster back toward the requested replica count. A Service provides a stable network name and address for a changing set of matching Pods, so clients do not need to track individual Pod addresses.
Describe the desired state
Kubernetes objects are commonly described with YAML. This example asks for two replicas of a web application image:
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:stable
ports:
- containerPort: 80
The manifest is a request, not a script that starts two machines immediately. Kubernetes validates the object, records the desired replica count, schedules Pods, and reports whether they become ready. The example uses a readable tag for teaching; pin a reviewed version or image digest for controlled deployments. Configure resource requests, limits, probes, and access policies for the workload.
Explore a learning cluster
Use a local learning environment such as kind or minikube rather than experimenting on a production cluster. After creating a practice cluster and applying a Deployment manifest, inspect its state with:
kubectl get nodes
kubectl get deployments
kubectl get pods
These read-only commands show cluster nodes, Deployments, and Pods. Compare the requested replica count with the current and ready counts, then inspect events and logs when a Pod is not ready. Learn to remove your practice resources when finished, and keep real cluster credentials out of shared files.
When Kubernetes is a good fit
Kubernetes is useful when a team needs a consistent way to deploy, update, and monitor container workloads across multiple machines. It also brings operational complexity: clusters need upgrades, access control, networking, storage, monitoring, and incident response. A single small application may be simpler to run directly with Docker or a managed application platform.
Keep the infrastructure layers straight
- Physical host or VM: provides CPU, memory, storage, and network devices.
- Operating system and container runtime: run and isolate container processes on each node.
- Kubernetes: schedules and reconciles Pods and Services across nodes.
- Application: handles the product behavior users actually need.
Kubernetes can run on a virtualized cluster or on physical nodes. Learn the VM and container boundaries first, then add Kubernetes when the operational benefits justify running a cluster.