Kubernetes Guide: How Kubernetes Works, What It Runs and When to Use It

This Kubernetes guide answers a simple question: what does Kubernetes actually do, and when is it worth using? Kubernetes is an open-source platform for running containers at scale, and it has become the standard way many teams deploy and operate applications made of many small services.

The central question is how a team keeps dozens or hundreds of containers running, updated and healthy without managing each one by hand. The answer is that Kubernetes takes a description of the desired state of an application and does the work of making reality match it, starting replacements when containers fail, spreading load across machines, and rolling out new versions without downtime.

Key takeaways

  • Kubernetes is a container orchestration platform: it runs containers, keeps them healthy, and scales them up and down.
  • The pod is the smallest unit Kubernetes manages, and it usually holds a single container.
  • Deployments describe how many copies of an application should run, while services give those copies a stable network address.
  • Kubernetes is powerful, but it adds real operational complexity, so simple applications often do not need it.

What Kubernetes is

Kubernetes, often shortened to K8s, is an open-source system for automating the deployment, scaling and management of containerised applications. It was developed at Google, drawing on Google’s experience running containers internally, and was released as an open-source project in 2014, with version 1.0 following in 2015. It is now maintained under the Cloud Native Computing Foundation, which graduated the project in 2018.

To understand what Kubernetes does, start with containers. A container packages an application with the libraries and files it needs to run, so it behaves the same way on a developer’s laptop as it does on a server. Docker is the best-known tool for building and running containers, and it works well for a single application on a single machine. The problem starts when there are many containers across many machines, and somebody must decide where each one runs, restart the ones that crash, and update them all safely.

That is the job Kubernetes takes on. It watches the state of the whole system, compares it with the state described in configuration files, and takes action to close the gap. If a container crashes, Kubernetes starts a replacement; if traffic rises, it adds more copies; if a new version is released, it replaces old containers gradually, so users see no interruption.

How Kubernetes works: the control plane and the nodes

A Kubernetes cluster is a group of machines that work together as one system. The machines fall into two roles: the control plane, which makes decisions, and the worker nodes, which run the application containers.

The control plane

The control plane is the brain of the cluster. Its central component is the API server, through which every instruction passes, whether it comes from a person using the command-line tool kubectl, from an automated deployment pipeline, or from another part of the system. Behind the API server sits etcd, a database that stores the cluster’s configuration and current state.

Two other components do the decision-making. The scheduler looks at new work and decides which node should run it, based on available CPU, memory and placement rules. The controller manager runs loops that watch the state of the system and correct it, such as starting a replacement container when one disappears.

The worker nodes

Worker nodes run the containers. Each node runs a small agent called the kubelet, which receives instructions from the API server and makes sure the containers assigned to that node are running as described. Nodes also run a container runtime, which starts and stops containers, and a network component called kube-proxy, which handles traffic routing to the containers on that node.

The building blocks: pods, deployments and services

Kubernetes introduces a handful of concepts that describe how applications are packaged and exposed. These three cover most of what the platform does day to day.

Pods: the smallest unit

A pod is the smallest unit that Kubernetes manages. A pod usually contains a single container, although it can hold several containers that need to work closely together, sharing the same network address and storage. Pods are deliberately short-lived: Kubernetes can create and destroy them at any time, so applications must cope with individual pods disappearing without warning.

Each pod gets its own IP address inside the cluster. When a pod dies, its replacement gets a new address, which is why applications never rely on a pod’s address directly.

Deployments: describing what should run

A deployment declares how many copies of an application should run, and which version of the container image they should use. If a deployment says three copies should exist, Kubernetes keeps three pods running, starting replacements whenever one fails or a node goes down.

Deployments also handle updates. When the container image changes to a new version, a deployment replaces pods gradually, checking that each new pod is healthy before moving on. If the new version is broken, the deployment can be rolled back, which is one of the main reasons teams adopt Kubernetes for applications they update frequently.

Services: a stable address for shifting pods

Because pods come and go, an application needs a stable way to reach them. A service provides a fixed network address and a name that always points at the healthy pods behind it, spreading incoming traffic across them. A service inside the cluster is the usual choice for communication between services, while a load balancer service exposes an application to the internet. An ingress can sit above services, routing web traffic by host name or path so one public address serves several applications.

Approach What it does Best suited to Main trade-off
Plain containers Runs containers on one or a few machines Single applications and small projects Manual scaling, restarts and updates
Virtual machines Runs whole operating systems on shared hardware Workloads needing full isolation or a specific operating system Heavier and slower to start than containers
Kubernetes Orchestrates containers across many machines Applications made of many services that change often Significant operational complexity to learn and run
Serverless functions Runs short pieces of code on demand, with no servers to manage Event-driven work and variable traffic Less control over the runtime and cold-start delays
Developer working at a dark desk with a cluster dashboard glowing on the screen in lime green
A cluster dashboard shows the state of pods, deployments and services at a glance, helping operators spot a failing pod before users notice.

How a deployment actually happens

In practice, working with Kubernetes means writing configuration files, usually in YAML, that describe the desired state, and applying them with kubectl, the command-line tool. A typical file for a deployment names the container image, the number of copies, the ports the application listens on, and the CPU and memory each copy may use.

Once applied, the control plane takes over. The scheduler places pods on nodes with enough capacity, the kubelets start the containers, and the service begins routing traffic once health checks pass. Changing the file and applying it again is how updates are made: Kubernetes works out the steps to move from the old state to the new one.

Configuration beyond the basics lives in related objects. ConfigMaps hold settings that vary between environments, while Secrets hold sensitive values such as passwords and API keys. Persistent volumes provide storage that survives a pod being replaced, which stateful applications such as databases need. Namespaces divide a cluster into areas for different teams or environments.

Scaling, self-healing and updates

Three behaviours explain most of Kubernetes’ appeal. The first is self-healing: health checks, called probes, tell Kubernetes whether a container is ready to receive traffic and whether it is still alive, and a container that fails its checks is restarted or replaced automatically.

The second is scaling. A horizontal pod autoscaler can add or remove copies of an application based on demand, such as CPU use or incoming requests. This lets an application handle a traffic spike without anyone watching a dashboard, and scale back down afterwards.

The third is the rolling update. Because updates happen gradually and can be reversed, teams release more often and with less fear, which is why Kubernetes is closely associated with modern continuous delivery.

What Kubernetes is good at, and what it is not

Kubernetes earns its keep when an application is made of many services that need to scale independently, update frequently, or survive individual machines failing. It is also the natural choice when a team runs the same application across several environments or cloud providers, because the same configuration works wherever a cluster exists.

It is less obviously useful for a single simple application. Running a cluster means maintaining the control plane, upgrading Kubernetes itself, watching for failing nodes, and learning a large set of concepts before anything is productive. Managed services remove much of the control-plane work, but the team still has to understand pods, services and deployments.

There is also a cost to consider. Kubernetes is not a way to save money on small workloads, and a cluster too large for its traffic wastes capacity. For applications with uneven or unpredictable traffic, a serverless approach can be simpler and cheaper, because there are no servers or clusters to keep running when nothing is happening.

Checklist: deciding whether to adopt Kubernetes

  • Confirm the application already runs well in containers before adding orchestration on top.
  • Count the services: with only one or two, a simpler hosting option may be enough.
  • Check the team can invest time in learning pods, deployments, services and networking.
  • Choose a managed cluster first, so the cloud provider maintains the control plane.
  • Design the application so individual pods can disappear without losing user data or sessions.
  • Set resource requests and limits on every workload so one service cannot starve the rest.
  • Add health checks to every service so Kubernetes can detect and replace failing containers.
  • Plan how updates, rollbacks and cluster upgrades will be tested before reaching production.

Frequently asked questions

What is Kubernetes in simple terms?

Kubernetes is a system that runs containers for you, deciding where they run, restarting them when they fail, and scaling them as demand changes. You describe the state you want, and Kubernetes works continuously to keep the system in that state.

Is Kubernetes the same as Docker?

No. Docker builds and runs containers on a single machine, while Kubernetes manages containers across many machines. They work together: Kubernetes typically runs containers built with Docker or a similar tool.

What is a pod in Kubernetes?

A pod is the smallest unit Kubernetes manages, usually containing a single container. Pods are short-lived and replaceable, so applications should never depend on a specific pod staying alive.

Do I need Kubernetes for a small website?

Usually not. A single website or small application is simpler and cheaper to run on a virtual machine, a container on one server, or a managed hosting platform. Kubernetes becomes useful with many services, frequent releases, or traffic that needs automatic scaling.

How do I learn Kubernetes?

Start with the official documentation at kubernetes.io, which includes tutorials and a guide to running a cluster locally. Deploying a simple application on a small local cluster teaches the core concepts faster than reading about them alone.

What does Kubernetes cost?

Kubernetes itself is open source and free to use. The costs come from the machines that run the cluster and, with managed services, the fee for maintaining the control plane.

The bottom line

Kubernetes is a powerful answer to a specific problem: keeping many containers healthy, scaled and updated across many machines. Its core ideas are simple, a desired state declared in files, a control plane that enforces it, and pods, deployments and services that turn the declaration into a running application.

That power has a price in complexity, so the right question is not whether Kubernetes is good, but whether the application is large and changeable enough to repay the investment. If it is, start small, use a managed cluster, and let the platform earn its place one workload at a time.

Latest articles

Scroll to Top