What Is a Cluster in Kubernetes?
A plain-English tour of the most important word in Kubernetes: what a cluster is, what lives inside it, how its parts talk to each other, and why almost every modern company runs its software on one.
If you have ever opened a Kubernetes tutorial, you have seen the word “cluster” in the very first paragraph. “Create a cluster.” “Connect to your cluster.” “Deploy this to the cluster.” It is used so casually that beginners often nod along without being sure what it actually means. Is a cluster a computer? A program? A building full of servers? A folder of settings?
The honest answer is that a cluster is a little of each idea, and once you see how the pieces fit, every other Kubernetes concept becomes easier. In this guide you will start from zero. You will learn what a cluster is, why it exists, what parts it has, how those parts cooperate to keep your applications alive, how traffic finds its way in, how big or small a cluster can be, and how to keep one secure and healthy. Along the way you will meet real examples from companies that run thousands of machines as a single cluster.
1What Is a Cluster? The Short Answer
A Kubernetes cluster is a group of computers that work together as if they were one big computer, run by a single manager.
Start with the smallest idea: a container
Modern software is usually packed into containers. A container is a sealed box that holds a program together with everything that program needs to run, such as its libraries and settings. Because the box is sealed, it runs the same way on your laptop, on a test server, and in a data center. This solves the old complaint “it works on my machine, but not on yours.”
One container is easy to handle. But a real company may need thousands of them: a box for the website, boxes for the payment system, boxes for search, boxes for sending emails, and several copies of each so that nothing breaks when one fails. Somebody has to decide which computer runs which box, restart the ones that crash, add more when traffic grows, and remove them when traffic falls. That somebody is Kubernetes.
Now the definition
A cluster is the complete Kubernetes system that does this job. It has two kinds of members. The first is a group of worker nodes, which are the computers that actually run your containers. The second is the control plane, which is the brain that decides what should run where and keeps watching to make sure reality matches the plan. Together, the brain and the workers form one cluster, and you talk to that cluster as a single unit.
Think of a large restaurant kitchen. The head chef and the order desk are the control plane: they read the incoming orders, decide which cook prepares which dish, and check that every plate leaves on time. The individual cooks and stoves are the worker nodes, where the food is really made. Customers never talk to a single cook. They place an order with the restaurant, and the kitchen as a whole delivers. A cluster is that whole kitchen.
What a cluster is not
- It is not one special computer. A cluster is made of many ordinary computers, which can be physical servers, cloud virtual machines, or even containers pretending to be computers on a laptop.
- It is not your application. The cluster is the platform. Your application is what you place on it.
- It is not a folder of settings. Settings tell the cluster what you want, but the cluster is the living system that carries those wishes out.
The vocabulary ladder
Beginners often mix up words that sit at different levels. It helps to see them as a ladder, from the biggest idea to the smallest. The cluster sits at the top because everything else lives inside it.
| Word | What it means | Kitchen comparison |
|---|---|---|
| Cluster | The whole system of control plane and worker nodes | The entire restaurant kitchen |
| Node | One machine inside the cluster | One cooking station |
| Namespace | A named partition inside the cluster | A section such as pastry or grill |
| Pod | The smallest unit of running work | One plate being prepared |
| Container | A packaged program running inside a Pod | One ingredient prepared in its own bowl |
When someone says “deploy to the cluster,” picture handing a work order to the kitchen manager. You never choose the exact stove. You describe the dish, and the cluster finds a place to cook it.
2Why Clusters Exist: The Problem They Solve
To appreciate the cluster, imagine life without one.
The single-server world
In the early days of the internet, a company would place its website on one big server. That was simple, but it had painful limits. If the server broke, the website went dark. If traffic doubled on a sale day, the server slowed down or crashed. If engineers wanted to update the software, they often had to take the site offline. And buying a bigger server has a ceiling: at some point no larger machine exists, and the biggest ones cost enormous amounts of money.
The many-server world, done by hand
The next step was to buy many smaller servers and spread the work between them. This is more flexible, but it creates new chores. Someone must log in to each machine, install the software, keep versions in sync, watch for failures, and move workloads around when a machine dies. With ten servers this is annoying. With ten thousand it is impossible without automation. Large companies built internal systems to automate it. Google’s system was called Borg, and the lessons from Borg shaped Kubernetes, which Google released to the public in 2014.
The cluster as the answer
A cluster turns many machines into one pool of computing power. You stop asking “which server should run this?” and start saying “I need three copies of this program, each with a certain amount of memory.” The cluster figures out the rest. If a machine dies, the cluster notices and starts replacements elsewhere. If traffic grows, the cluster can add more copies, and, with the right setup, even more machines.
Compare a single giant truck with a delivery fleet. The truck is powerful, but if it breaks down, all deliveries stop, and you cannot buy a truck twice as big forever. A fleet of many vans, coordinated by a dispatcher, keeps working when one van fails, and you can add vans on busy days. The cluster is the fleet, and Kubernetes is the dispatcher.
The five gifts of a cluster
Self-healing
Crashed containers are restarted, and work on a failed machine is moved to healthy machines automatically.
Scaling
Add or remove copies of an application as demand changes, either by a command or automatically by rules.
Safe updates
New versions are rolled out gradually. If they misbehave, they can be rolled back to the previous version.
Efficient use of hardware
Many different applications share the same machines, filling gaps so that expensive computers do not sit idle.
Portability
The same cluster ideas work on a laptop, in your own data center, and on every major cloud, so you are not trapped in one place.
3The Anatomy of a Cluster
Every cluster, from a tiny practice cluster to a giant production one, has the same basic shape.
flowchart TB
subgraph CP["Control Plane - the brain"]
API["API Server - the front door"]
ETCD[("etcd - the cluster memory")]
SCH["Scheduler - chooses a node"]
CM["Controller Manager - fixes any gap"]
API --> ETCD
SCH --> API
CM --> API
end
subgraph W1["Worker Node 1"]
K1["kubelet - node agent"]
KP1["kube-proxy - network rules"]
RT1["Container Runtime"]
POD1["Pods running your app"]
K1 --> RT1
RT1 --> POD1
end
subgraph W2["Worker Node 2"]
K2["kubelet - node agent"]
KP2["kube-proxy - network rules"]
RT2["Container Runtime"]
POD2["Pods running your app"]
K2 --> RT2
RT2 --> POD2
end
USER["You or your automation tools"] --> API
API --> K1
API --> K2
Read the diagram from the top. Every request, whether it comes from a person at a keyboard or from an automated pipeline, enters through the API server. The API server records what you asked for in etcd, the cluster’s memory. The scheduler and the controller manager watch the API server for new work. Down in the worker nodes, a small agent called the kubelet listens to the API server for jobs that belong to its own machine, and starts the containers for them.
Two halves, two jobs
| Question | Control plane | Worker nodes |
|---|---|---|
| Main job | Decide, record, and supervise | Run the containers |
| Kitchen comparison | Head chef and order desk | Cooks and stoves |
| Runs your application? | Normally no | Yes |
| How many are typical? | Three or five for safety | From one to thousands |
| If it fails | You cannot change the cluster, but running apps usually continue | Its Pods are recreated on other nodes |
How the parts find and trust each other
A cluster is made of many separate programs, so they need a safe way to meet. Every component talks to the API server over an encrypted connection, and each one proves its identity with a certificate, which works like a signed photo badge that the cluster’s own certificate authority issues. When a new machine joins, it receives a temporary credential, introduces itself, and is given a permanent badge once accepted. After that, the kubelet on the machine sends a small heartbeat message at regular intervals so the control plane knows the machine is alive.
The people who use the cluster receive a small connection file, often called a kubeconfig. It lists the address of the API server, the credentials to use, and a default namespace. Each entry in this file, called a context, is a shortcut for one cluster and one identity. Engineers who work with several clusters switch between contexts the way you switch between saved contacts on a phone. Keep this file safe, because it may contain the keys to the kingdom.
Many people also say “data plane” for the worker side. It simply means the place where your real work and real user traffic happen, in contrast to the control plane, where decisions are made.
4Inside the Control Plane
The control plane is small in size but huge in importance. Let us meet its members one at a time.
kube-apiserver
The only component everyone talks to. It checks who you are, whether you are allowed to do what you ask, and whether the request is valid. Then it saves the result and tells the others.
etcd
A small, consistent database that stores the full state of the cluster: every Deployment, every Service, every setting. Only the API server talks to it directly.
kube-scheduler
Looks at each new Pod that has no home, filters out nodes that lack room, ranks the rest, and picks the best one.
kube-controller-manager
Runs many small watchers. One keeps the right number of Pod copies, one reacts to failed nodes, one manages endpoints, and so on. Each compares “wanted” with “actual” and closes the gap.
cloud-controller-manager
Present in cloud-based clusters. It talks to the cloud provider to create load balancers, attach disks, and notice when a virtual machine is deleted.
etcd: the memory that must never be lost
Of all these parts, etcd deserves special respect. It is the single source of truth. If the scheduler crashes, it can be restarted with no loss. If the API server crashes, another copy can take over. But if etcd loses its data and there is no backup, the cluster forgets what it was supposed to run. That is why etcd is normally run as a group of three or five copies that vote on every change using an agreement method called consensus. As long as a majority of the copies are alive, the cluster keeps working. With three copies, one can fail. With five copies, two can fail. Using an odd number avoids tie votes.
Picture a company that keeps its official record book in three separate offices. Every new entry must be approved by at least two offices before it counts. If one office burns down, the other two still hold a trusted copy. If they had only two offices and one was lost, a tie would leave nobody able to approve new entries, which is why the count is odd.
The API server as a good receptionist
The API server does not just pass messages along. For every request it performs three checks in order. Authentication asks who you are. Authorization asks whether you are allowed to do this specific action. Admission control asks whether the request follows the cluster’s rules, and may even adjust it, for example by adding a default memory limit. Only after passing all three does the request get saved. Because everything goes through this one door, it is also the best place to add security and auditing.
Whoever can reach and control the API server can control the whole cluster. Protect access to it more carefully than almost anything else you own.
5Inside a Worker Node
A worker node is just a computer with three small programs installed. Those programs turn an ordinary machine into a member of the cluster.
kubelet: the node’s manager
The kubelet registers the node with the control plane, listens for Pods assigned to it, tells the container runtime what to start, and reports health back. It also runs the health checks you defined for your applications.
Container runtime: the engine
The container runtime pulls container images and starts and stops containers. Common runtimes are containerd and CRI-O. Kubernetes talks to them through a standard interface, so the choice is mostly invisible to you.
kube-proxy: the traffic guide
Kube-proxy maintains network rules on the node so that a request sent to a Service address gets forwarded to one of the healthy Pods behind it, even if that Pod lives on another node.
What a node contributes
Each node offers a fixed amount of processor time, memory, and disk. Kubernetes reads these numbers when the node joins, keeps a little aside for the system itself, and treats the rest as allocatable. The scheduler uses these numbers like a hotel manager checking which rooms are free. When you say that a container needs a certain amount of memory, you are making a reservation, and the scheduler only places the Pod on a node with enough unreserved room.
Looking after nodes: maintenance without downtime
Machines need regular care: security patches, operating system updates, and hardware repairs. A cluster makes this safe with a two-step routine. First the node is cordoned, which means “do not place any new Pods here.” Then it is drained, which means the existing Pods are politely asked to leave and are recreated on other nodes. Once the node is empty, engineers can update or replace it, and afterward they allow work to return. Because a Deployment always keeps the wanted number of copies running, users notice nothing, provided the cluster has enough spare room and important apps run more than one copy.
Nodes can be almost anything
A node can be a physical server in a data center, a virtual machine from a cloud provider, or, in a local practice cluster, a container that pretends to be a machine. To the cluster it does not matter. All it needs is the kubelet, a runtime, and a network path to the control plane. That is why the same cluster ideas apply from a tiny laptop setup to a giant cloud deployment.
Treat worker nodes like disposable lightbulbs, not like pets. A healthy cluster expects nodes to break, be replaced, and be upgraded regularly. Your applications should never depend on one particular node staying alive.
6What Lives Inside a Cluster
Machines are only the stage. The actors are the objects you create inside the cluster.
Pod
One or more tightly linked containers that share a network address and storage. A Pod is the smallest thing Kubernetes schedules. Think of it as a single apartment where housemates share the same front door.
Deployment
Says “keep this many identical Pods running, and update them safely when the version changes.” It is the most common way to run an application.
Service
Gives a group of Pods one stable name and address. Pods come and go, but the Service stays put, like a company phone number that rings whichever employee is on duty.
Ingress
Routes web traffic from the outside world to the right Service, often based on the website address or path in the request.
ConfigMap and Secret
Separate configuration from code. A ConfigMap holds ordinary settings. A Secret holds sensitive values like passwords, with extra protection options.
Namespace
A named partition inside the cluster. Teams or environments get their own room, with their own limits and permissions, while sharing the same machines.
flowchart TB
subgraph CL["One Kubernetes cluster"]
subgraph NS1["Namespace: shop-production"]
D1["Deployment: web"] --> P1["Pods"]
S1["Service: web"] --> P1
end
subgraph NS2["Namespace: shop-testing"]
D2["Deployment: web"] --> P2["Pods"]
S2["Service: web"] --> P2
end
subgraph NS3["Namespace: payments-team"]
D3["Deployment: billing"] --> P3["Pods"]
S3["Service: billing"] --> P3
end
end
Notice that two namespaces can each contain an object called “web” without any conflict, because names only need to be unique inside their own room. Namespaces do not create hard walls by themselves, though. To stop teams from harming each other you also add permissions, resource limits, and network rules, which we cover in the security chapter.
7Internal Working: The Desired-State Loop
The secret behind every cluster is a very simple habit repeated forever: compare what you want with what exists, and fix the difference.
Desired state versus actual state
When you use a cluster you never give step-by-step instructions such as “start a container on machine number seven.” You state the goal, for example “always keep three copies of the checkout service running.” This goal is called the desired state. What is really running at any moment is the actual state. Inside the control plane, many controllers run in endless loops, each watching one kind of object. Whenever the two states differ, the controller takes a small action to bring them closer. This idea is called reconciliation.
A thermostat is a perfect small model. You set the desired temperature. The thermostat measures the actual temperature, and if the room is too cold, it turns on the heater; if it is warm enough, it turns the heater off. You never tell it how long to heat. A cluster does the same with your applications, thousands of times a minute.
What happens when a machine dies
sequenceDiagram
participant N as Worker Node 2
participant API as API Server
participant NC as Node Controller
participant RC as Replica Controller
participant SCH as Scheduler
participant K3 as kubelet on Node 3
N--xAPI: Stops sending heartbeats
NC->>API: Notice missing heartbeats and mark node as not ready
NC->>API: Mark the Pods on that node for replacement
RC->>API: Count Pods, find 2 of 3 and create a new Pod
SCH->>API: Assign the new Pod to Node 3
K3->>API: Notice the new Pod assigned to me
K3->>API: Start the containers and report Pod running
Every node sends a regular heartbeat to the control plane, a little message meaning “I am alive.” When the heartbeats stop for long enough, the node controller marks the node as not ready. The replica controller then sees that the Deployment wants three Pods but only two are healthy, so it creates a new Pod record. The scheduler chooses a healthy node, and the kubelet there starts the containers. No human was woken up. The whole cycle usually completes within minutes, and users of a well-designed application may never notice.
How controllers hear about changes
You might wonder how controllers notice a change so quickly without pestering the API server every second. They use a watch: a long-lived connection over which the API server pushes a small message whenever an object of interest is created, changed, or deleted. Each controller reacts to those messages and also does a full check now and then, in case a message was missed. This design keeps traffic low and reactions fast, and it explains how one control plane can supervise thousands of nodes.
Avoiding two bosses: leader election
In a high-availability cluster, three copies of the scheduler and the controller manager may all be running. If all three acted at once, they would fight, for example by placing the same Pod on three different nodes. To prevent this, the copies hold an election. One becomes the leader and does the real work, while the others wait, ready to take over within seconds if the leader disappears. The API servers, by contrast, can all work at the same time behind a load balancer, because they mostly read and write the shared database rather than make decisions.
This is why the phrase “declarative” appears so often in Kubernetes. You declare the end result; the cluster keeps working until reality matches it, and keeps checking afterward.
8Data Flow and Lifecycle
Two journeys matter: how your instructions reach the cluster, and how a user’s request reaches your application.
Journey one: from your keyboard to a running Pod
You describe the goal
You write a configuration file saying what you want and send it through a command-line tool or an automated pipeline.
The API server validates and stores it
After identity, permission, and rule checks, the goal is saved in etcd.
Controllers create the work
Controllers see the new goal and create Pod records that have no home yet.
The scheduler picks nodes
Each Pod gets a node based on free room and any rules you set, such as “keep these Pods in different zones.”
The kubelet starts containers
The chosen node downloads the image, starts the containers, and runs health checks.
The Pod becomes ready
Once the readiness check passes, the Pod is added behind its Service and begins receiving traffic.
Journey two: from a customer’s phone to your code
flowchart LR
U["Customer browser"] --> DNS["DNS - finds the address"]
DNS --> LB["Cloud Load Balancer"]
LB --> ING["Ingress Controller - routes by address and path"]
ING --> SVC["Service - stable address"]
SVC --> PA["Pod A on Node 1"]
SVC --> PB["Pod B on Node 2"]
SVC --> PC["Pod C on Node 3"]
PA --> DB[("Database")]
PB --> DB
PC --> DB
A customer types your website address. DNS translates the name into the address of a load balancer, which spreads incoming connections across the cluster’s entry points. The ingress controller reads the request, decides which Service should handle it, and forwards it. The Service then picks one of its healthy Pods, possibly on a completely different node, and the Pod does the real work, perhaps calling a database. The Service address stays the same even while Pods are replaced behind it. This single idea, a stable front with changing members behind it, is why upgrades and crashes stay invisible to users.
The lifecycle of a Pod
Pods are mortal. A Pod is created, waits to be scheduled, pulls its images, runs, and eventually ends, either because it finished its job, was replaced during an update, or lost its node. Kubernetes never “repairs” a Pod in place. It replaces it with a fresh copy. For this reason, anything precious such as customer data must live outside the Pod, in a database or a persistent disk, and not in the Pod’s own temporary storage.
The stages a Pod passes through
Kubernetes summarizes a Pod’s life with a few simple phases. Pending means the Pod has been accepted but is not running yet, perhaps because it is waiting for a node with enough room or for its image to download. Running means at least one container is up. Succeeded means every container finished its job and exited cleanly, which is normal for one-time tasks. Failed means the containers ended with an error. If a Pod stays Pending for a long time, the events usually explain why, such as a shortage of memory across all nodes or a mistyped image name. Learning to read these phases is the fastest route to becoming comfortable with debugging clusters.
9Cluster Networking and Storage
Two things turn a pile of machines into a usable platform: a network where every Pod can be found, and disks that outlive the containers.
The networking promises
Kubernetes makes a few clear promises about networking, and a component called a network plugin keeps them. Every Pod receives its own address. Every Pod can talk to every other Pod without awkward translation, even across nodes. Nodes can talk to Pods, and Pods can talk to nodes. On top of this, Services provide stable names, and DNS inside the cluster lets one application find another simply by name, like calling a friend by name instead of remembering a number.
Picture a big office building where every desk has its own direct phone line. The network plugin is the phone system installer. The Service is the company switchboard: callers dial one main number, and the switchboard connects them to whoever is available. Employees may move desks all day, yet the main number never changes.
Three ways to expose an application
A Service comes in several types, and each answers the question “who should be able to reach this application?” in a different way.
- ClusterIP: the default. The Service gets an address that works only inside the cluster. It is ideal for internal parts such as a database or a background worker.
- NodePort: opens the same port on every node, so outside traffic can enter through any machine. It is simple but rough, and mostly used for testing.
- LoadBalancer: asks the cloud provider to create a real load balancer with a public address that forwards traffic to the Service. This is the common choice for exposing an application on the internet.
Above these sits Ingress, which shares a single load balancer between many websites by looking at the requested address, saving both money and effort. On a laptop cluster, there is no cloud to create a real load balancer, so local tools provide substitutes.
Network policies: rules for who may call whom
By default, in most clusters, all Pods may talk to all other Pods. That is convenient for learning but risky for production. Network policies let you state rules such as “only the web Pods may call the payment Pods.” They work like locked doors between departments, and they require a network plugin that supports them.
Storage: giving containers a long memory
Containers have a short memory by design. When one is replaced, its private files disappear. For data that must survive, Kubernetes offers volumes. A PersistentVolume is a piece of real storage, such as a cloud disk, and a PersistentVolumeClaim is a Pod’s request for storage of a certain size. A StorageClass describes the type of disk, so the cluster can create the right disk automatically when a claim appears. When a Pod that uses such a disk is replaced, the disk is reattached to the new Pod and the data is still there.
Why this design helps
- Applications never need to know which machine they run on
- Storage requests are written once and work across different clouds
- Pods can be moved freely without losing their data
Where beginners struggle
- Disks in a cloud usually live in one zone, so a Pod may only restart in that zone
- Network plugins differ in features and speed
- Forgetting to use persistent storage causes surprise data loss
10Cluster Sizes and Shapes
Not every cluster looks the same. The right shape depends on what you need to protect against.
Single-node cluster
One machine plays both roles. Perfect for practice and quick tests on a laptop with tools like Minikube or kind. It offers no protection if the machine fails.
One control plane, several workers
A modest layout for small teams and test environments. Workers can fail without stopping the cluster, but the single control plane is a weak spot.
High-availability cluster
Three or five control plane machines, spread across separate zones, with workers in several zones too. Losing a machine or even a whole building does not stop the cluster.
Multiple clusters
Several separate clusters, for example one per region or per environment, joined by a global traffic layer and shared deployment tools.
flowchart TB
LBAPI["Load balancer in front of the API"] --> CP1["Control plane 1 in Zone A"]
LBAPI --> CP2["Control plane 2 in Zone B"]
LBAPI --> CP3["Control plane 3 in Zone C"]
CP1 --- E1[("etcd copy 1")]
CP2 --- E2[("etcd copy 2")]
CP3 --- E3[("etcd copy 3")]
CP1 --> WA["Workers in Zone A"]
CP2 --> WB["Workers in Zone B"]
CP3 --> WC["Workers in Zone C"]
How big can one cluster get?
The Kubernetes project documents a comfortable range for a single cluster of up to about 5,000 nodes, 150,000 Pods, and 110 Pods per node. Real companies push near or beyond these figures with careful tuning. OpenAI has publicly written about running Kubernetes clusters of several thousand nodes for machine learning, and Google has publicly announced support for GKE clusters with tens of thousands of nodes. Most organizations never come close, and that is fine. Bigger is not better, because a larger cluster is also a larger blast radius when something goes wrong.
Where clusters live
The same cluster ideas apply in three very different homes. On a laptop, tools such as Minikube and kind create small clusters in minutes for learning and testing. In a company data center, teams install Kubernetes on their own servers with tools such as kubeadm or with enterprise products, and they take responsibility for every part, including the control plane and backups. In the public cloud, managed services such as Amazon EKS, Google GKE, and Azure AKS run the control plane for you across several zones, and you decide how many workers to attach. Most companies use a mix: laptop clusters for development, automated temporary clusters for testing, and managed clusters for production.
One big cluster or many small ones?
This is one of the most debated questions in real teams. One large cluster shares hardware efficiently and is simpler to manage in a single place, but a bad upgrade or a mistake affects everyone. Many smaller clusters isolate problems, satisfy laws that require data to stay in a country, and let teams move at their own speed, but they cost more in duplicate overhead and need good tooling to manage together. A common middle path is one cluster per environment (development, staging, production) and one per region for production.
11Scaling and High Availability
A cluster earns its keep when demand jumps and when hardware fails. Both are handled by scaling and by redundancy.
Three ways to scale
Horizontal Pod scaling
Add or remove copies of an application based on measurements such as processor use or requests per second. More copies share the load.
Vertical scaling
Give each copy more or less memory and processor. Useful when a single copy needs more room, though changing it may restart the Pod.
Cluster scaling
Add or remove worker machines. When Pods cannot find room, a cluster autoscaler asks the cloud for new machines, and when machines sit nearly empty, it removes them to save money.
A supermarket on a holiday morning opens more checkout lanes (more Pod copies). If every lane is already open and the line still grows, the store brings in extra cashiers and extra registers from the storage room (more machines). When the rush ends, it closes lanes to save wages. The cluster does the same, with rules you define in advance.
Telling the scheduler how to place work
By default the scheduler simply looks for free room. Real systems often need more control, and the cluster offers several gentle tools. Resource requests reserve a minimum amount of processor and memory for a container, while limits set the maximum it may use. Node selectors and affinity rules attract Pods to nodes with certain labels, for example machines that have fast disks or graphics processors. Anti-affinity rules do the opposite and push copies of the same app apart, so that no single node or zone holds them all. Taints mark a node as off-limits to ordinary Pods, and only Pods carrying a matching toleration may enter, which is how teams reserve special machines for special jobs.
Think of a hotel front desk. Requests are the reservations guests make. Affinity is the guest asking for a room near the elevator, and anti-affinity is the manager placing rival tour groups on different floors. A taint is a sign saying “staff only,” and a toleration is the staff badge that opens the door.
Building for high availability
- Spread the control plane across three zones so that no single building failure stops the brain.
- Spread the workers across zones and ask Kubernetes to place copies of the same app in different zones.
- Run more than one copy of every important application. A single copy is a single point of failure.
- Use health checks so traffic is only sent to Pods that are truly ready.
- Set disruption budgets that promise a minimum number of copies stay up during upgrades and repairs.
- Back up etcd and application data, and practice restoring from those backups.
High availability of the cluster does not automatically give high availability of your application. If your app runs only one copy, or stores its data on one disk in one zone, a perfectly healthy cluster can still lose you customers.
12Advantages, Disadvantages, and Trade-offs
A cluster is a powerful tool, but not every project needs one.
Advantages
- Automatic recovery from crashes and machine failures
- Easy scaling up and down with demand
- Rolling updates and quick rollbacks
- Better hardware use by sharing machines between apps
- One common way to run software on any cloud or data center
- A huge community and ecosystem of tools
Disadvantages
- A steep learning curve with many new terms
- Extra cost for the control plane and idle capacity
- More moving parts, which means more things to secure and watch
- Overkill for a tiny site with a few users
- Misconfigured clusters can be expensive or unsafe
- Upgrades must be planned regularly
Where the money goes
A cluster has three main cost buckets. The first is the control plane, which is free or lightly charged on some managed services and a fixed monthly fee on others, and on a self-managed cluster it means the machines and the engineers who care for them. The second, and usually the biggest, is the worker nodes, since you pay for their processor and memory whether or not your Pods fill them. The third is everything around the cluster: load balancers, disks, backups, and data transfer between zones or out to the internet. The most common waste is over-provisioning, where teams reserve far more memory and processor than their applications use. Measuring real usage, setting realistic requests, and letting autoscaling remove idle machines often cuts the bill dramatically.
Key trade-offs
| Choice | You gain | You give up |
|---|---|---|
| Self-managed cluster | Full control and flexibility | Time and the burden of running the control plane |
| Managed cluster from a cloud | Less work and built-in high availability | Some control and a recurring fee |
| One big cluster | Efficient sharing and central management | A larger blast radius |
| Many small clusters | Isolation and independence | Higher overhead and more tooling |
| Extra spare capacity | Fast reaction to spikes | Money spent on idle machines |
| Very strict security rules | Lower risk | Slower development and more setup |
A useful rule of thumb: if you run a handful of small services with modest traffic, a simpler platform may serve you better. Once you have many services, several teams, changing traffic, and a need for reliability, the cluster starts to pay for itself many times over.
13Cluster Security
A cluster can start any program on demand across many machines. That power is exactly why attackers want it, and why security must be planned early.
Secure a cluster the way you would secure a large office campus. The main gate needs a guard (authentication). Each badge opens only certain doors (authorization). Departments sit behind their own locked doors (network policies). Valuables sit in a safe (secrets). Cameras record who went where (audit logs). Skipping any one layer leaves a gap that a determined visitor will find.
The layers of defense
Authentication
Connect the cluster to your company sign-in system so people use real, individual accounts instead of shared passwords. Automated tools use short-lived credentials.
RBAC
Role-based access control assigns permissions to roles, and roles to people or programs. Start with the least access that works, and add more only when needed.
Network policies
Restrict which Pods may talk to which. A breach of one app then cannot easily spread to the rest of the cluster.
Secrets management
Encrypt secrets at rest, limit who can read them, and prefer an external secrets manager for passwords and keys.
Pod security
Do not run containers as an administrator, block dangerous privileges, and use read-only file systems wherever possible. Kubernetes has built-in Pod Security Standards for this.
Supply chain
Scan images for known flaws, pull only from trusted registries, and sign images so that a tampered one is rejected.
Control plane hardening
Limit who can reach the API server, encrypt etcd, and keep Kubernetes patched to a supported version.
Audit logging
Record every important API call so investigators can answer who changed what, and when.
Exposing a dashboard or the API server to the whole internet with weak protection. Many well-known cluster breaches began with an unprotected management door, not with a clever attack. Keep management interfaces private and require strong sign-in.
Tenant isolation inside a shared cluster
When several teams share one cluster, namespaces alone are not enough. Combine them with separate permissions per namespace, resource quotas that cap how much each team can consume, and network policies between namespaces. For very strict needs, such as running code from unknown customers, use separate clusters or stronger sandboxing for the containers.
14Monitoring, Logging, and Metrics
A cluster that you cannot observe is a cluster you cannot trust. Watching it means collecting three kinds of signals.
Metrics
Measurements over time, like processor use, memory use, request rates, and error counts. They answer “how much” and “how fast,” and they feed autoscaling and alerts.
Logs
Text records of what programs did. They answer “what exactly happened” and are vital when a container crashes and disappears.
Traces
The path of one request across many services, showing where time was spent. Very useful in systems made of many small parts.
Events
Short messages the cluster writes about itself, such as “could not pull image” or “not enough memory to schedule.” They are the first place to look when a Pod will not start.
What to watch at each level
| Level | Healthy signs | Warning signs |
|---|---|---|
| Control plane | Fast API responses, healthy etcd, steady leader | Slow API calls, etcd disk delays, many failed requests |
| Nodes | Ready status, spare memory and disk | Not ready, memory or disk pressure |
| Pods | Running, few restarts | Crash loops, pending for a long time, frequent restarts |
| Applications | Low errors, steady response time | Rising errors, slow responses |
| Cost | Steady, understood spending | Sudden jumps or idle machines |
Health checks: how the cluster knows a Pod is truly fine
A running process is not always a working process. An application can be alive but stuck, or alive but still loading data. Kubernetes lets you describe three kinds of checks, called probes. A startup probe gives slow applications time to start before anyone judges them. A readiness probe tells the cluster when the Pod is ready to receive traffic, and while it fails, the Pod is quietly removed from its Service. A liveness probe tells the cluster when the Pod is stuck, and a failure causes it to be restarted. Well-chosen probes are among the cheapest ways to make an application more reliable.
Common tools
Kubernetes includes a small metrics server that powers basic usage views and autoscaling. Most teams add Prometheus to collect metrics, Grafana to draw dashboards, and a log collector such as Fluent Bit or a cloud logging service to gather container logs into one searchable place. Cloud providers offer their own integrated options, and OpenTelemetry has become a popular standard for traces. Choose tools that fit your team’s size, and start with a few useful dashboards instead of hundreds of unused ones.
Alert on what customers feel, such as errors and slow pages, not on every small internal wobble. Too many noisy alerts teach people to ignore all of them.
15Design Patterns and Anti-Patterns
Patterns are habits that healthy teams share. Anti-patterns are shortcuts that feel smart today and hurt later.
Patterns that work
Cluster as cattle, not pet
Keep everything needed to rebuild a cluster in files under version control. If a cluster dies, you create another rather than nursing the old one.
Cluster per environment
Separate clusters, or at least separate accounts, for development, staging, and production, so a mistake in one cannot reach the others.
Spread across zones
Place copies of important apps in different availability zones so one building failure removes only a portion of your capacity.
Requests and limits
Tell the cluster how much memory and processor each container needs, so the scheduler can place Pods sensibly and one hungry app cannot starve the others.
GitOps
Store the desired state of the cluster in a Git repository and let a tool such as Argo CD or Flux apply it. Every change is reviewed, recorded, and reversible.
Small blast radius
Split unrelated systems into separate clusters or namespaces with quotas, so a runaway problem stays contained.
Anti-patterns to avoid
What it looks like
Running a single copy of an important application, or a single control plane machine, in production.
Why it hurts
One failure removes the service. The cluster can restart a lost Pod, but there is a gap in service while it does, and a lone control plane leaves the cluster unmanageable if it fails.
Do this instead
Run at least two or three copies of every important app, and use a high-availability control plane spread across zones.
What it looks like
Changing a live cluster by hand and never recording what was done.
Why it hurts
Nobody can reproduce the setup, and the next engineer inherits a mystery. Differences between clusters, called drift, quietly grow.
Do this instead
Make every change through files in version control and apply it with automation.
What it looks like
Putting everything for every team into one giant cluster with everyone as an administrator.
Why it hurts
One typing mistake can delete other teams’ work, and one noisy application can slow everyone down.
Do this instead
Use namespaces, quotas, and least-privilege roles, or split into several clusters when the stakes are high.
What it looks like
Storing important data only inside a Pod’s own temporary storage.
Why it hurts
When the Pod is replaced, the data is gone. Replacement is normal in a cluster, so the loss is not a bug, it is the design.
Do this instead
Keep important data in persistent volumes or managed databases, and back it up.
16Best Practices and Common Mistakes
These are lessons teams often learn painfully. You can learn them cheaply, right now.
Best practices
- Keep Kubernetes up to date. Each version is supported for roughly a year. Upgrade one version at a time, and test on a staging cluster first.
- Use a managed control plane if you can. Running etcd and the API server well is hard work that a cloud provider does for you.
- Label everything. Labels are small tags on objects that let you find, group, and select them, and they drive cost tracking and monitoring.
- Define health checks. Readiness checks keep traffic away from Pods that are not ready. Liveness checks restart Pods that are stuck.
- Set resource requests and limits for every container.
- Enable autoscaling at both the Pod and machine level, with sensible minimums and maximums.
- Back up and rehearse recovery. A backup that has never been restored is only a hope.
- Automate cluster creation with files or infrastructure tools so a new cluster takes minutes, not weeks.
- Review permissions regularly and remove access that is no longer needed.
- Watch cost. Tag resources by team, review the bill monthly, and delete unused clusters and disks.
Common mistakes
| Mistake | What happens | Better habit |
|---|---|---|
| No resource limits | One app eats all memory and other apps get evicted | Set requests and limits based on measured use |
| Using the “latest” image tag | Unpredictable versions appear after restarts | Use exact version tags |
| Too few nodes for upgrades | Pods cannot move while a node is being updated | Keep spare capacity and set disruption budgets |
| Leaving default permissions | Pods have more access than they need | Give each app its own limited identity |
| Ignoring old versions | Security holes and forced emergency upgrades | Plan upgrades on a calendar |
| Treating logs as optional | A crashed Pod leaves no trace | Ship logs to a central place from day one |
| Skipping backups of etcd and data | A disaster becomes permanent | Automate backups and test restores |
17Real-World and Industry Examples
These examples come from what the organizations have said publicly, and details may have changed since.
Google and the Borg lineage
Kubernetes grew out of lessons from Borg, the internal system Google used to run its search, mail, and video services across enormous fleets of machines. Google has said that the cluster manager idea, one brain coordinating a huge pool of machines, was central to running its services efficiently. Google Kubernetes Engine now offers that model as a managed product, and Google has publicly announced support for clusters with tens of thousands of nodes.
OpenAI and very large clusters
OpenAI has written publicly about running Kubernetes at the scale of several thousand nodes to train large machine learning models, and about the tuning that required, from the database behind the API server to the networking layer. Their story shows that clusters can grow very large, but each increase in size demands careful engineering.
Spotify moving to Kubernetes
Spotify has described migrating hundreds of its backend services from an internal container system to Kubernetes running on Google Cloud. The main goal was to let its many engineering teams share a common, well-supported platform instead of maintaining their own tools.
Pinterest and its own platform
Pinterest has spoken publicly about building its own Kubernetes-based platform on AWS, with multiple clusters serving different needs. It illustrates how large organizations often run several clusters and add their own layers on top to suit their workloads.
A typical online store
Imagine a shop with separate services for the catalog, cart, payments, and recommendations. On the cluster, each service is a Deployment with several Pods spread across three zones. A Service and an ingress route customers to the right one. On a sale day, autoscaling adds Pods for the busy cart service and asks the cloud for extra worker machines. In the evening it removes them. Nobody logs in to a single server, and a failed machine during the sale is a small event, not a crisis.
18Frequently Asked Questions
19Summary and Key Takeaways
Key Takeaways
- A cluster is a team of machines run as one. A control plane makes decisions and worker nodes run your containers, all reached through a single API.
- The control plane has five main parts. The API server, etcd, the scheduler, the controller manager, and, in the cloud, the cloud controller manager. Protect etcd and the API server above all.
- Worker nodes are disposable. Each runs a kubelet, a container runtime, and kube-proxy, and the cluster expects nodes to fail and be replaced.
- Desired state is the heart of Kubernetes. You declare the goal, and controllers keep comparing it with reality and fixing the gap, which is what gives the cluster self-healing power.
- Design for failure and for growth. Spread the control plane and workers across zones, run multiple copies of important apps, use autoscaling, and keep persistent data outside Pods.
- Security, monitoring, and cost are ongoing jobs. Use least-privilege access, network policies, encrypted secrets, central logs, useful alerts, and regular upgrades, whether the cluster is managed or not.