Skip to main content

Infrastructure and deployment

What is Kubernetes?

Definition

Kubernetes is an open-source system that runs containers across a cluster of machines, scheduling them and continuously keeping the declared state true.

Also known as: K8s

Kubernetes in more detail

The model is declarative. You submit YAML describing what should exist — three replicas of this image, reachable on this port, with these resource limits — and a control loop compares that desired state against reality and acts until they match. A crashed container is restarted, a lost node's workloads are rescheduled elsewhere, and a changed image rolls out gradually. You never tell Kubernetes how to do any of it.

A handful of objects carry most of the work. A Pod is the smallest unit, one or more containers that share a network namespace and storage. A Deployment manages a ReplicaSet of identical Pods and handles rolling updates and rollbacks. A Service gives that changing set of Pods a stable virtual address and load-balances across them. An Ingress or Gateway routes outside HTTP traffic in, ConfigMaps and Secrets inject configuration, and StatefulSets and PersistentVolumes handle workloads that cannot be treated as interchangeable.

Its power is also its cost. Kubernetes assumes a distributed system and hands you networking, storage, RBAC, autoscaling and rollout policy as things to configure — for a single application on one server that is a great deal of machinery to operate. It pays off with many services, several teams, real scaling requirements or a genuine need to be portable across providers, and managed control planes remove a large part of the burden.

Kubernetes example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 3
  selector:
    matchLabels: { app: web }
  template:
    metadata:
      labels: { app: web }
    spec:
      containers:
        - name: web
          image: myapp:1.4
          ports: [{ containerPort: 3000 }]
          resources:
            requests: { cpu: "100m", memory: "128Mi" }
            limits:   { cpu: "500m", memory: "512Mi" }
          readinessProbe:
            httpGet: { path: /healthz, port: 3000 }
---
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector: { app: web }
  ports: [{ port: 80, targetPort: 3000 }]

$ kubectl apply -f web.yaml
$ kubectl rollout status deployment/web

Kubernetes — common questions

Do I need Kubernetes for a small application?
Usually not. One or two services run happily on a managed platform, a VM with Docker Compose, or a serverless runtime. Kubernetes earns its complexity when you have many services, multiple teams, or scaling and portability requirements that simpler platforms cannot meet.
What is a pod?
The smallest deployable unit: one or more containers that share a network namespace, an IP address and optionally volumes, always scheduled together on one node. Most pods hold a single application container plus any sidecars it needs.
Is Kubernetes the same as Docker?
No. Docker builds and runs individual containers on one machine; Kubernetes orchestrates containers across many machines. Kubernetes runs OCI images built by Docker or anything else, using a runtime such as containerd.

Keep reading

Every definition in the set is indexed A-Z in the developer glossary, and the cheat sheets cover the syntax once you know what you are looking for.

Browse the A-Z glossary