In brief
Kubernetes makes sense when a company runs many services in containers, several teams deploy them independently, and traffic varies enough that autoscaling and self-healing deliver real value. With a few applications and one team, a simpler platform is usually enough: a cloud provider's container service or virtual machines with automated deployment. The cost of Kubernetes is not a license but people: upgrades, security, networking and cluster monitoring.
What Kubernetes gives you and what it does not
Kubernetes is a platform for running containers across many machines. You describe the desired state, for example “three instances of the payment service, each with a set memory limit”, and Kubernetes makes sure it stays that way: it starts missing instances, moves them off a failed node, distributes traffic and swaps versions without downtime.
Kubernetes gives you:
- one way of deploying all services, regardless of language and team;
- self-healing: restarting a container that has stopped responding to the health check;
- scaling the number of instances based on load;
- gradual rollouts with the ability to roll back a version quickly;
- portability between a data center and different cloud providers.
What Kubernetes will not give you is a good application architecture. A service that keeps sessions in memory and cannot tolerate a restart will cause more trouble on Kubernetes than on an ordinary virtual machine. It also will not solve database backups, secrets management or observability for you; these are separate components that have to be chosen and maintained.
When Kubernetes makes sense
Kubernetes usually pays off when several conditions are met at once:
- the company runs a dozen or more services in containers and the number is growing;
- several teams deploy independently, often several times a week;
- traffic varies during the day or at peaks, for example an insurer's sales campaign or month-end settlements;
- the same platform is needed in the data center and in the cloud, for example because of data location requirements.
Telecom operators are a good example. Network functions increasingly run as containers (CNFs), and the operator's IT systems need a shared platform anyway. Such a project is described in the scenario a Kubernetes platform for network functions and operator IT systems, and the technology background in the article NFV and SDN.
When something simpler is enough
At small scale, Kubernetes adds more work than it saves. Simpler options are better when:
- the company has a few applications and one team that develops them;
- deployments happen once every few weeks;
- traffic is steady and predictable;
- nobody on the team has experience running a cluster, and there is no budget to build that experience.
In that case, a cloud provider's container service in which you do not manage a cluster, a PaaS-type platform, or virtual machines with automated deployment from a CI pipeline are enough. You can move to Kubernetes later, if the applications are already in containers and do not depend on a local disk.
A managed service or your own cluster
At cloud providers, the cluster control plane is run by the provider, and the team manages worker nodes and applications. This is a reasonable default, because the hardest part of operations, the availability and upgrades of the control plane, passes to the provider.
Your own cluster in a data center makes sense when data or network functions have to run locally, when the company has its own hardware and a steady, heavy load, or when supervisory requirements restrict the use of the public cloud. Then the team is responsible for everything: from etcd and certificates to networking and data storage.
| Decision | Managed service | Own cluster |
|---|---|---|
| Control plane | run by the provider | run by the team |
| Version upgrades | simpler, in the provider's windows | entirely on the team |
| Data location | provider regions | anywhere |
| Required skills | applications, networking, security | everything, including cluster infrastructure |
The hidden cost: upgrades and skills
Kubernetes changes quickly. The project maintains release branches for the three latest minor versions, and each of them receives fixes for about a year. In practice this means upgrading the cluster every few months, including checking that application manifests do not use deprecated APIs.
On top of that come the platform team's ongoing duties:
- security policies: RBAC permissions, network policies, image scanning;
- observability: logs, metrics and traces from all services, described in the article Observability;
- cluster and application definitions as code, versioned in a repository, which we cover in the article Infrastructure as code;
- shared templates and deployment paths for product teams.
That last item is in practice building an internal platform. How to organize it so that teams do not have to know the details of Kubernetes is discussed in the article Platform engineering.
Where to start
Start with one stateless service that already has a container image and automated tests. Run it on a managed service, with deployment from a CI pipeline, monitoring and a rollback plan. Only when this path works without manual steps, move further services. Move databases and stateful systems last, or leave them in managed services outside the cluster.
Before the first service goes to production, check that it:
- has CPU and memory requests and limits set, derived from measurements and not copied from an example;
- responds to readiness and liveness checks that tell the truth about its state;
- tolerates being stopped at any moment, because Kubernetes moves containers during node upgrades;
- reads configuration and secrets from outside, not from the image, as described in the article Secrets in applications;
- has a rehearsed version rollback, before it is needed at night.
Questions and answers
Does Kubernetes reduce infrastructure costs?
It can, because it lets you pack services more densely onto nodes and scale them with traffic. Often, though, the first year costs more: cluster operations, tooling and team time are added. Savings appear when there are many services, resource limits are set from measurements and unused environments are shut down automatically.
Should databases run on Kubernetes?
They can, but it is a decision for a team that knows both worlds well. Kubernetes supports stateful applications, and database operators automate part of the maintenance. Even so, backups, disaster recovery and upgrades are harder than in a managed service. For most companies the more sensible start is a database outside the cluster.
How many people does it take to run Kubernetes?
It depends on the scale and on whether the cluster is managed by a provider. Even with a managed service it is worth having at least two people who know the platform, so that a vacation or illness does not stop deployments. With your own clusters in a data center and many teams, a separate platform team is needed.
Does Kubernetes make sense for legacy applications?
Rarely as a first step. An application designed for a single server, with local files and sessions in memory, needs changes before it can benefit from scaling and self-healing. Earlier, it is worth assessing which migration strategy fits the application, as described in the article Cloud migration strategies.