EMZETT.
Login

Kubernetes basics

In short: Kubernetes (K8s) manages many containers on many machines: it starts them, restarts crashed ones, spreads load and rolls out new versions step by step. You describe the desired state, Kubernetes creates it.

Terms

  • Cluster: several machines (nodes) steered by a control plane.
  • Pod: smallest unit, one or more containers sharing network and storage.
  • Deployment: “I want 3 copies of this application in version 1.4.” It replaces pods on updates without downtime.
  • Service: fixed address and load balancing in front of changing pods.
  • Ingress: access from outside (HTTP/HTTPS) to services, see Web servers compared.
  • ConfigMap and Secret: settings and secrets separate from the container image.

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: nginx:1.27
          ports: [{ containerPort: 80 }]

kubectl apply -f web.yaml creates it, kubectl get pods shows the state.

Under the hood

Containers use kernel features from containers on Linux. Kubernetes does not bring its own containers but controls a runtime (containerd, CRI-O).

Is it worth it?

For one or two applications it is usually too much. It pays off with many services, high availability and teams. To practise: minikube, kind or k3s. Beginner knowledge on containers: Podman and Docker compared.

See also: Ansible for beginners