Kubernetes Tutorial · Kubernetes Basics · Lesson 1 of 26

What Is Kubernetes?

What Kubernetes does, the problems it solves, and when you don't need it.

Create a free account to save this page, take notes and track your progress. Sign in

The short answer

Kubernetes (often K8s) runs containers across a cluster of machines and keeps them running the way you described. You declare the desired state ("three copies of this image, reachable at this name, with these limits"); Kubernetes' controllers continuously compare it with the actual state and fix differences: they restart crashed containers, replace failed nodes' pods, roll out new versions and scale.

What it gives you:

  • Scheduling of containers onto machines with enough CPU and memory.
  • Self-healing: restarts, rescheduling, health checks.
  • Service discovery and load balancing inside the cluster.
  • Rolling updates and rollbacks.
  • Configuration and secrets separate from images.
  • Autoscaling of pods and, with cloud integrations, of nodes.

When you don't need it

A single service, a small team, or a platform-as-a-service that already runs containers for you (Cloud Run, App Runner, Container Apps, Fly.io) is often simpler. Kubernetes pays off with many services, teams and environments.

The cluster used for these examples
kubectl version -o json | python3 -c 'import json,sys; v=json.load(sys.stdin); print("client", v["clientVersion"]["gitVersion"], "| server", v["serverVersion"]["gitVersion"])'
kubectl get nodes -o custom-columns=NODE:.metadata.name,STATUS:.status.conditions[-1].type,KUBELET:.status.nodeInfo.kubeletVersion,RUNTIME:.status.nodeInfo.containerRuntimeVersion

Output

client v1.37.1 | server v1.37.0
NODE                    STATUS   KUBELET   RUNTIME
rc-docs-control-plane   Ready    v1.37.0   containerd://2.3.4

Run this on your computer — see “Get Started” for setup.

Every example in this tutorial was run with kubectl against a real (throwaway) cluster when the page was built. See Kubernetes overview.

Test yourself

What does it mean that Kubernetes is declarative?

  1. You run commands step by step
  2. You describe the desired state and controllers keep changing the cluster to match it
  3. Configuration is written in Python
  4. It only works with Docker
Show answer

Answer: You describe the desired state and controllers keep changing the cluster to match it

Controllers run reconciliation loops: observe, compare with the desired state, act.

Was this page helpful?