Kubernetes Explained Simply 2026 - Orchestration, Networking & K8s vs Docker Swarm
Kubernetes for beginners: what it is, core concepts (pods, deployments, services, clusters), how Kubernetes networking works, and how K8s compares to Docker Swarm.
Once you have containers, you need something to run, scale and heal them automatically. That is Kubernetes - the industry-standard way to operate containerised apps at scale.
This page assumes you already know what an image and a container are. If not, start with Docker explained for beginners - Kubernetes runs containers, it does not build them.
What is Kubernetes?
Kubernetes (K8s) is a container orchestration platform that manages the deployment, scaling and availability of containerised applications across a cluster of machines.
Why DevOps uses Kubernetes
It provides high availability, automatic scaling, self-healing (restarting failed containers), and rolling updates with zero downtime.
The underlying idea is worth stating once, because it explains everything else: Kubernetes is a control loop. You declare the state you want - three replicas of this image - and a controller continuously compares that against reality and acts to close the gap. Kill a pod and one reappears, not because something detected a crash, but because the count no longer matched.
Core concepts
- Pod: the smallest unit - one or more containers running together.
- Deployment: manages how many pod replicas run and how they update.
- Service: a stable network endpoint that routes traffic to pods.
- Cluster: the set of machines (nodes) Kubernetes runs everything on.
What that looks like in YAML
A Deployment and a Service - between them, the minimum to get an application running and reachable inside a cluster.
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.2.0
ports:
- containerPort: 3000
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 256Mi
readinessProbe:
httpGet:
path: /healthz
port: 3000
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80
targetPort: 3000
Two fields there do more than beginners expect:
- The label selector. The Service finds pods by matching
app: web, not by name or address. Labels are the entire routing mechanism - a typo in a label is the most common reason a Service returns nothing. - The readiness probe. Without it, Kubernetes sends traffic to a pod the moment the container process starts, which is usually before the application can serve requests. That is why deploys that "should be zero downtime" produce a burst of errors.
Resource requests tell the scheduler how much to reserve; limits cap usage. Setting a memory limit and no request is a common misconfiguration - the scheduler then packs pods onto nodes that cannot actually feed them.
Debugging a pod that will not start
This sequence handles most cases, in this order:
kubectl get pods
kubectl describe pod web-7d9f8b-xk2p1
kubectl logs web-7d9f8b-xk2p1
kubectl logs web-7d9f8b-xk2p1 --previous
get gives the status, and the status name is usually the answer. ImagePullBackOff means the cluster cannot fetch the image - wrong tag, or missing registry credentials. CrashLoopBackOff means the container starts and exits repeatedly, so read the logs, and use --previous because the current attempt may not have logged anything yet. Pending usually means no node has enough free resources to satisfy the requests, which describe will say at the bottom under Events.
Reading the Events section of describe before anything else will save you more time than any other Kubernetes habit.
How Kubernetes networking works (basics)
Every pod gets its own IP, and pods can talk to each other directly within the cluster. Because pods come and go, you do not target them by IP - a Service gives a stable address and load-balances across the healthy pods behind it. An Ingress then exposes services to the outside world and routes external HTTP traffic by host/path. This is what lets apps scale and move without breaking connections.
The three Service types you will actually meet
| Type | Reachable from | Typical use |
|---|---|---|
| ClusterIP (the default) | Inside the cluster only | Service-to-service traffic: the frontend calling the API, the API calling the database |
| NodePort | A fixed port on every node | Quick tests and labs; rarely what you want in production |
| LoadBalancer | The internet, through a cloud load balancer | Exposing a single service directly. On EKS, AKS or GKE each one creates its own cloud load balancer, and each one is billed |
That last point is why Ingress and Gateway API exist. Ten services exposed as ten LoadBalancers means ten load balancers on the bill. One shared entry point that routes by hostname and path is cheaper, and it gives you a single place for TLS certificates and access logs.
Ingress, Gateway API and the end of Ingress NGINX
For years the standard answer to "how does outside traffic reach my pods" was an Ingress object handled by the community Ingress NGINX controller, and most older tutorials still teach exactly that. It changed in 2026. In November 2025, Kubernetes SIG Network and the Security Response Committee announced that Ingress NGINX would be retired, and best-effort maintenance ended in March 2026. There are no more releases, bug fixes or security patches. Existing installations keep running, which is the real risk: an internet-facing component that nobody patches any more.
Two things get mixed up here, in interviews too. The Ingress API is still part of Kubernetes. It is feature-frozen, not removed. What was retired is one popular controller that implemented it. So you can keep writing Ingress objects with a different controller, or move to Gateway API, which is the replacement the Kubernetes project recommends.
| Ingress | Gateway API | |
|---|---|---|
| Who owns what | One object mixes load-balancer settings and application routing | Split by role: GatewayClass (platform team), Gateway (cluster operators), HTTPRoute (application teams) |
| Advanced routing | Header matching, traffic splits and rewrites live in annotations, and every controller spells them differently | Header and path matching, weighted traffic splits and redirects are part of the spec |
| Protocols | HTTP and HTTPS | HTTP and gRPC routes are stable, and TLS, TCP and UDP routes joined them in the Standard channel in 2026 (Gateway API v1.5 and v1.6); support for the non-HTTP routes still varies by implementation |
| Status | Stable and frozen | Stable (v1), and where new features are being added |
The same "send shop.example.com to the web Service" rule, written as an HTTPRoute:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: web
spec:
parentRefs:
- name: public-gateway
hostnames:
- "shop.example.com"
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: web
port: 80
The parentRefs line is the role split in action. The application team writes the route and attaches it to a Gateway that someone else runs, so they never touch load-balancer settings or TLS certificates. Implementations include Envoy Gateway, Istio, Cilium, NGINX Gateway Fabric and the managed controllers on the major clouds.
If you are learning now, understand Ingress, because every existing cluster you inherit will have it, and practise with Gateway API, because that is where new work is going. A good interview answer to "this cluster still runs Ingress NGINX, what do you do?" is an inventory, not a panic: list every Ingress object and the annotations it relies on, choose a replacement controller or move to Gateway API, migrate one low-risk hostname first, and keep the old controller running until the traffic has moved.
Kubernetes vs Docker Swarm
Docker Swarm is simpler to set up and fine for small deployments, but Kubernetes is far more powerful - richer scaling, self-healing, a huge ecosystem, and support on every major cloud. The industry has standardised on Kubernetes, which is why it dominates job postings; Swarm is now a niche choice.
When not to use Kubernetes
Worth being able to say out loud in an interview, because it signals judgement rather than enthusiasm. A single application with modest traffic, run by a small team, does not need a cluster. A managed container service or even a couple of virtual machines behind a load balancer will be cheaper, easier to reason about and faster to debug at 2am.
Kubernetes earns its complexity when you have many services, several teams deploying independently, and real scaling or availability requirements. Adopting it before that mostly means someone now maintains a cluster instead of shipping features.
A sensible order to learn it in
- Week 1: a local cluster with kind or minikube. Pods, Deployments and Services, and the debugging sequence above until you run it without thinking.
- Week 2: ConfigMaps and Secrets, requests and limits, readiness and liveness probes. Break things on purpose: set a memory limit too low and watch the pod get OOMKilled, so you recognise it when it happens for real.
- Week 3: getting traffic in. One LoadBalancer Service, then a Gateway with two HTTPRoutes, then TLS on top.
- Week 4: a managed cluster on EKS, AKS or GKE, created with Terraform, with an application deployed to it from a pipeline. Tear it down when you finish each session so the bill stays small.
Helm, operators, service meshes and autoscaling come after that. They make far more sense once the basics have become boring.
Try it: watch the control loop on your own laptop
Desired state makes far more sense once you have seen it happen. This takes about twenty minutes and needs only Docker or Podman running. It uses kind, which runs a whole cluster inside containers; its current release, v0.33, gives you Kubernetes 1.37 unless you ask for an older node image.
kind create cluster --name lab
kubectl create deployment web --image=nginx:1.30 --replicas=3
kubectl get pods -l app=web --watch
Leave the watch running in one terminal and type the rest in a second one.
- Delete a pod by name with
kubectl delete pod. Within seconds a new one appears in the watch. The ReplicaSet saw two pods where three were wanted, and made one. - Change the target.
kubectl scale deployment web --replicas=5, then back to 3. Same loop, different number. - Add a Service.
kubectl expose deployment web --port=80, thenkubectl port-forward service/web 8080:80and openlocalhost:8080.kubectl get endpointslices -l kubernetes.io/service-name=webshows the pod IPs the Service found through its label selector. - Roll out a new version.
kubectl set image deployment/web nginx=nginx:1.31. New pods come up before old ones go. The container is callednginxbecausekubectl create deploymentnames it after the image. - Roll out a broken one. Repeat with
nginx:9.9, a tag that does not exist. The new pod sticks in ImagePullBackOff while the old three carry on serving: by default a Deployment lets at most 25% of its pods, rounded down, be unavailable during an update, and with three replicas that is none.kubectl rollout undo deployment/webreturns you to 1.31.
Clean up with kind delete cluster --name lab. After one run through this, the YAML earlier on this page reads differently, because you have watched each part do its job.
Industry usage
Startups and enterprises alike use Kubernetes to run containerised applications reliably at scale, which is why K8s skill is one of the biggest salary levers in DevOps.
For learning, a local cluster with kind or minikube is enough to cover everything on this page. Managed services - EKS, AKS and GKE - are what you will use at work, and they remove the hardest part, which is running the control plane yourself.
Related Learning Resources
Terraform & Infrastructure as Code Explained 2026 - IaC, Terraform vs CloudFormation & Config Management
A beginner's guide to Infrastructure as Code with Terraform: what IaC is and why it matters, how Terraform works across clouds, Terraform vs CloudFormation, and how configuration management fits in.
Docker Explained for Beginners 2026 - Containers, Images & Docker vs VMs
A beginner's guide to Docker: what containers are, how images and Dockerfiles work, how Docker differs from virtual machines, and how DevOps teams use Docker in CI/CD and Kubernetes.
GitOps Explained: ArgoCD, Flux and Progressive Delivery
How the reconciliation loop actually works, how Argo CD and Flux differ once you live with them, what canary and blue-green add on top, and the secrets and drift problems tutorials skip.
Ready to Start Your DevOps Career?
Join our comprehensive DevOps + GenAI course with hands-on projects, live mentorship, and placement support