Sub topic 2
What Kubernetes Is and What It Is Not
This chapter assumes you know what containers and container images are, can use a Linux shell, and can read YAML. It defines Kubernetes, lists what it provides, and marks where its responsibilities end.
A working definition
Kubernetes is an open-source system that runs containerized applications across a group of machines and keeps them in the state you describe. You tell it what you want, for example "three copies of this image, reachable on port 80". Kubernetes then starts, restarts, moves, and connects containers to make that true.
A group of machines managed this way is a cluster. Each machine in it is a node. Kubernetes treats the whole cluster as one pool of CPU, memory, and network capacity.
What Kubernetes provides
The previous chapter covered the pain of running containers by hand at scale. Kubernetes answers it with a set of built-in capabilities:
| Capability | What it means in practice |
|---|---|
| Scheduling | Places each container workload on a node with enough free resources. |
| Self-healing | Restarts failed containers and replaces Pods whose node has died. |
| Scaling | Changes the number of running copies when you edit a number or an autoscaler does. |
| Rollouts and rollbacks | Replaces old versions with new ones gradually and can undo a bad release. |
| Service discovery and load balancing | Gives a changing set of containers one stable address. |
| Configuration and storage | Supplies settings, secrets, and volumes to containers. |
The shape of the system
You never talk to nodes directly. You send requests to one API, and components inside the cluster act on them.
The control plane makes decisions. The worker nodes run your containers. Later chapters open each part.
What Kubernetes is not
Many early mistakes come from expecting Kubernetes to do more than it does.
- Not a container runtime. It does not build or run containers itself. It asks a runtime such as containerd to do that.
- Not a build or CI/CD system. It does not compile code, build images, or decide when to deploy. Other tools do that and then submit manifests to it.
- Not a Platform as a Service. It offers building blocks, not a finished developer platform. Logging, monitoring, and application-level services are choices you make.
- Not a fix for a badly designed application. It restarts a crashing container but cannot make the code correct. Data stored only inside a container is lost when the container is replaced.
- Not limited to one vendor. It runs on laptops, data centers, and public clouds with the same API.
A first look
Once you have access to a cluster, one command shows what you are talking to:
kubectl get nodesThe output lists each node and its status. Every later example in this tutorial builds on that same pattern: ask the API for state, or send it a description of the state you want.
Exercise
A teammate says, "Kubernetes will build our Docker image from source whenever we push code." Is that correct? Name what Kubernetes does instead.
Show answer
No. Kubernetes does not build images or watch your source code. A CI system builds and pushes the image to a registry. Kubernetes then pulls that image and runs it according to the manifest you submit, using a container runtime on each node.
Exercise
Name three capabilities Kubernetes provides that you would otherwise handle by hand when running containers on several machines.
Show answer
Any three of: scheduling containers onto nodes with free resources, restarting failed containers (self-healing), scaling the number of copies, gradual rollouts and rollbacks, stable service discovery and load balancing, and supplying configuration and storage.