Kubernetes
In one line
Kubernetes (K8s) is a platform that automates deploying, scaling, and managing containerized applications across clusters of machines.
In simple words
Kubernetes, often abbreviated as K8s, is a system for managing containers at scale. When you have just a few containers, you can manage them manually with Docker. But when you have hundreds or thousands of containers running across dozens of servers, you need Kubernetes.
Kubernetes handles: scheduling (deciding which server runs which container), scaling (adding or removing containers based on load), self-healing (restarting failed containers), and rolling updates (updating without downtime).
You describe what you want in YAML files — e.g., "I want 3 replicas of my web app" — and Kubernetes makes it happen. If a server crashes, Kubernetes automatically moves the containers to healthy servers.
Example
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: my-app:latestThis Deployment tells Kubernetes to run 3 replicas of the my-app container image.
How it works
- You write YAML manifests describing your desired state (e.g., 3 replicas).
- You submit them to the Kubernetes API server with
kubectl apply. - The scheduler places pods on available nodes.
- Controllers continuously reconcile actual state to match desired state.
- If a pod dies, Kubernetes restarts it automatically.
Common confusions
Confused with: Docker
The difference: Docker builds and runs individual containers; Kubernetes orchestrates many containers across a cluster of machines.
Related terms
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.