Outcome
By the end of this lesson, you will be able to explain what Kubernetes does, name its main parts, and say why a cluster can cost money for space nobody uses.
| Prerequisites | L1 |
| Time | 8 minutes |
1. Concept
Running two or three containers by hand is easy. Running hundreds, across many machines, is not. Someone has to decide which machine each container goes on, restart containers that crash, and add more when traffic grows.
Kubernetes does that job. It is free, open-source software, originally created at Google, that runs containers across a group of machines. People often shorten it to K8s (K, then eight letters, then s).
A useful picture: Kubernetes is the manager of a warehouse. Boxes (containers) arrive, and the manager decides which shelf (machine) each one goes on, moves boxes when a shelf breaks, and asks for more shelves when space runs out.
The parts you will hear about
- Cluster. The whole group of machines that Kubernetes manages, plus the brain that manages them.
- Node. One machine in the cluster. Usually a rented virtual machine.
- Pod. The smallest thing Kubernetes runs: one container, or a few that work closely together.
- Control plane. The brain of the cluster. It decides where pods go and keeps everything running.
Managed Kubernetes
Running the control plane yourself is hard work, so each provider offers a managed version where it runs the control plane for you: Amazon EKS on AWS, Google Kubernetes Engine (GKE) on Google Cloud and Azure Kubernetes Service (AKS) on Azure.
What Kubernetes costs
Kubernetes itself is free. You pay for what it runs on:
- The nodes. Each node is a rented machine, billed per hour like any VM. This is usually most of the cost.
- The cluster fee. Some providers charge a small hourly fee per cluster for running the control plane. The rules differ by provider and by tier, so check the pricing page.
- The disks, load balancers and data transfer the cluster uses, billed as usual.
Paying for empty space
This is the cost idea to remember. You pay for the whole node, not for the pods on it. If a node has room for ten pods and runs four, you still pay for all ten spaces.
Empty space builds up for ordinary reasons. Teams ask for more memory and processing power for their pods than the pods actually use, to be safe. Clusters are sized for the busiest hour and stay that size all day. A tool called a cluster autoscaler can add nodes when they are needed and remove them when they are not, but only if it is set up and allowed to remove them.
2. Worked example
A cluster has 5 nodes, each an illustrative $0.20 per hour, plus an illustrative cluster fee of $0.10 per hour.
| What | Amount | Unit price | Monthly cost |
|---|---|---|---|
| 5 nodes | 5 x 730 hours | $0.20 per hour | $730 |
| Cluster fee | 730 hours | $0.10 per hour | $73 |
| Total | $803 |
On a typical day, the pods use about 40% of the space the nodes offer. The other 60% is paid for and empty: 60% of $730 is $438 a month.
If the work were packed onto 3 nodes instead of 5, the node cost would be 3 x 730 x $0.20 = $438, a saving of $292 a month. Nothing about the apps changed; only how full the nodes were.
3. Hands-on (5 min: no account needed)
1. Open the pricing page for one managed Kubernetes service: - aws.amazon.com/eks/pricing - cloud.google.com/kubernetes-engine/pricing - azure.microsoft.com/pricing/details/kubernetes-service2. Find whether there is an hourly fee per cluster, and how much it is.3. Find the sentence that says what you pay for the worker nodes.4. Multiply the cluster fee by 730 for a monthly figure.You will see the same pattern on each page: a small fee for the cluster, and the nodes charged as ordinary machines.
4. Knowledge check
Q1
In Kubernetes, what is a node?
A. One machine in the cluster, usually a rented virtual machine
B. A single line on the cloud bill that lists the cluster
C. A copy of the app’s source code
D. The team that owns the cluster
Show answer
Correct: A. A node is one machine that pods run on. In the cloud it is nearly always a rented VM, billed per hour.
Q2
Most of the cost of a Kubernetes cluster usually comes from:
A. The Kubernetes software licence, paid per year
B. The number of pods, at a fee per pod
C. The nodes, billed per hour like any machine
D. The number of people who log in to it
Show answer
Correct: C. Kubernetes is free, open-source software. You pay mainly for the nodes, plus any cluster fee and the usual disks and transfer.
Q3
A node has room for ten pods but runs only four. What do you pay for?
A. Four tenths of the node’s price
B. Nothing, until the node is full
C. Only the four pods, at a per-pod rate
D. The whole node, empty space included
Show answer
Correct: D. The node is a rented machine, charged per hour regardless of how full it is. Empty space on nodes is one of the most common sources of waste in Kubernetes.
5. Apply
When someone mentions a Kubernetes cluster, ask two questions. How many nodes does it have? And how full are they, on average? A cluster that is half empty is paying for half its machines to do nothing.