Kubernetes
- Pronunciation
- KOO-ber-NET-eez
In short
Kubernetes is an open-source system that automates deploying, scaling, and managing containerized applications across a cluster of machines.
What is Kubernetes?
Kubernetes, often shortened to K8s, is a container orchestration platform. When an application runs as many containers across many servers, Kubernetes decides where each container runs, restarts containers that crash, scales them up or down with demand, and routes network traffic to them. It was originally created at Google and is now maintained by the Cloud Native Computing Foundation (CNCF).
Kubernetes is declarative: you describe the desired state in YAML files, such as 'run three copies of this web app', and Kubernetes continuously works to make reality match that description. Its key building blocks are pods (the smallest unit, one or more containers that run together), deployments (which manage copies of pods and roll out updates), and services (stable network addresses for a group of pods).
A good analogy is an orchestra conductor, which is where the word orchestration comes from. The musicians (containers) play the music, while the conductor makes sure the right number are playing, replaces anyone who stops, and keeps everything in sync. Major cloud providers offer managed Kubernetes services, so teams don't have to run the cluster's control plane themselves.
Kubernetes is often compared with Docker, but they solve different problems: Docker builds and runs individual containers, while Kubernetes manages many containers across a cluster. Kubernetes is powerful but complex, so small projects often do fine with simpler options such as Docker Compose, a platform as a service, or serverless hosting.
How it works
You describe what you want
A manifest says which image to run, how many copies and on which port.
replicas: 3You hand it to the cluster
The control plane stores it as the desired state.
kubectl apply -f app.yamlThe scheduler places pods
It picks nodes with enough CPU and memory and starts the containers there, in pods.
It keeps it that way
If a pod crashes or a node goes down, Kubernetes starts a new one until the cluster matches what you asked for.
3/3 ready
Often misunderstood
You might think: Kubernetes is an alternative to Docker.
In fact: Kubernetes runs containers; it does not build them. Images are still built with Docker or a similar tool, and Kubernetes starts them on many machines and keeps them running.
At a glance
Key takeaways
- Kubernetes orchestrates containers across a cluster of machines.
- You declare the desired state in YAML, and Kubernetes keeps it that way.
- Pods, deployments, and services are its core building blocks.
- It handles scaling, self-healing, rolling updates, and load balancing.
- K8s is short for Kubernetes: a K, eight letters, then an s.
Example
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3 # keep three copies of the container running at all times
selector:
matchLabels: { app: web }
template:
metadata:
labels: { app: web }
spec:
containers:
- name: web
image: example/web:1.0Readers ask
What is the difference between Docker and Kubernetes?
Docker is used to build container images and run containers, typically on one machine. Kubernetes runs and manages many containers across many machines, handling scheduling, scaling, and recovery, and it can run images built with Docker.
Why is Kubernetes called K8s?
K8s is a numeronym: the 8 stands for the eight letters between the K and the s in Kubernetes. The name itself comes from the Greek word for helmsman or pilot.
Do I need Kubernetes?
Not always. Kubernetes pays off when you run many services that need automated scaling and high availability; for a single small app, a simpler hosting platform or Docker Compose is usually enough.
See also
- Docker vs KubernetesDocker builds container images and runs containers on one machine, while Kubernetes runs them across a cluster, handling scheduling, scaling and self-healing.
- Docker Compose vs KubernetesDocker Compose runs a multi-container app on a single machine, while Kubernetes orchestrates containers across a cluster with scaling and self-healing.
- Kubernetes vs Docker SwarmBoth run containers across a cluster; Docker Swarm is built into Docker and simple to operate, while Kubernetes does far more at the cost of complexity.
- ContainerDevOps & Cloud, p. 13A container is a lightweight, isolated package that bundles an application with its dependencies and runs it on the host's shared operating system kernel.
- DockerDevOps & Cloud, p. 20Docker is an open-source platform for packaging an application and everything it needs into a container that runs the same way on any machine.
- Load BalancerDevOps & Cloud, p. 40A load balancer is a server or service that spreads incoming traffic across several backend servers so no single one is overloaded and the app stays available.
- DevOpsDevOps & Cloud, p. 17DevOps is a set of practices and a culture that brings software development and IT operations together to deliver software faster and more reliably.
- MicroservicesSoftware Architecture, p. 28Microservices are an architectural style where an application is split into small, independently deployable services that communicate over a network.
- CI/CDDevOps & Cloud, p. 9CI/CD is a set of automated practices that build, test, and release code changes frequently, so software can be delivered to users quickly and safely.
- HelmDevOps & Cloud, p. 31Helm is the package manager for Kubernetes: it bundles an app's configuration files into a chart you can install, upgrade and roll back with one command.
- kubectlDevOps & Cloud, p. 36kubectl is the command-line tool for Kubernetes: it sends requests to a cluster's API server to deploy applications, inspect them and change them.
- Docker SwarmDevOps & Cloud, p. 23Docker Swarm is the clustering mode built into Docker Engine: it joins several machines into one swarm and runs containers across them as replicated services.
- Kubernetes OperatorDevOps & Cloud, p. 38A Kubernetes operator is a custom controller that runs in the cluster and manages a complex application, such as a database, the way a human expert would.
Free · once a week
Software and AI, explained once a week
The week's software and AI news with every term explained, plus a term to learn and a quick quiz. A two-minute read.
See this week's issueAbout this page
Page history
Added "How it works": from a manifest to running pods, and how Kubernetes relates to Docker.
Changes that altered what this page says. Typo fixes are not listed.
Spotted a mistake or something missing on this page?Suggest an edit
How pages are made