Kubernetes: Why It Exists
Kubernetes exists because running containers by hand breaks down at scale. One container is simple. A hundred containers on ten machines are not.
Starting containers by hand is slow
Ten machines mean ten logins. Each login runs the same start command again.
docker run -d --name web nginx:1.27A stopped container stays stopped
A container crashes at night. Nothing restarts it until a human looks.
docker psAdding copies by hand means repeating yourself
Traffic doubles. You must start extra copies on extra machines by hand.
kubectl get deploymentsKubernetes states what you want
You declare three copies. Kubernetes makes three copies run and keeps them running.
kubectl get deploymentsExample
kubectl get deploymentsKey points
- Orchestration: the automatic management of many containers across many machines.
- Use Kubernetes to start containers on the right machine without logging in to each one.
- Use Kubernetes to replace a container that stops without a human noticing first.
- Use Kubernetes to add more copies of an app when traffic grows.
- Use Kubernetes to update an app without stopping it for every user.
In this example, the command asks Kubernetes to list the running copies. The output shows one app called web. Three copies are ready out of three wanted. Kubernetes keeps that count without further human commands.
Note
A single container on a single machine needs no orchestration.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
Why does Kubernetes exist?