Kubernetes essentials
Pods, deployments, services, ingress and operators: the building blocks of the most common container platform and how a request reaches a pod.
On the roadmap:Software Architect · step 1: Orchestration
Lesson 7 of 10 · 13 min read · quiz · exercise
What Kubernetes does
Kubernetes (K8s) runs containers across a cluster of machines. You describe the desired state (for example "three copies of this image, reachable at this address") and controllers continuously make reality match it: restarting failed containers, replacing lost nodes and rolling out new versions. (Containers themselves are introduced in the cloud models lesson.)
The cluster
- Control plane: the API server (everything talks to it), etcd (the consistent store of cluster state, built on Raft; see the consensus lesson), the scheduler (decides which node runs a pod) and controllers (reconcile desired and actual state).
- Nodes: machines that run pods, each with a node agent (kubelet), a container runtime and a networking component.
The core objects
Figure SDA-ADS-07-1 · From request to pod · © forcsguy.com
| Object | Purpose |
|---|---|
| Pod | Smallest unit: one or more containers sharing network and volumes |
| ReplicaSet / Deployment | Keep N pods running; roll out updates and roll back |
| Service | Stable virtual IP and DNS name that load balances to matching pods |
| Ingress | HTTP routing from outside to services (host, path, TLS), handled by an ingress controller |
| ConfigMap / Secret | Configuration and sensitive values injected as environment variables or files |
| StatefulSet | Pods with stable identity and storage, for databases and brokers |
| DaemonSet | One pod per node (log shippers, agents) |
| Job / CronJob | Run to completion, once or on a schedule |
| Namespace | Logical separation of resources and quotas |
| PersistentVolume(Claim) | Durable storage requested by pods |
Networking in one paragraph
Every pod gets its own IP and can reach every other pod without NAT. Because pods are short-lived, clients use Services (found through cluster DNS such as orders.shop.svc). Network policies restrict which pods may talk to which. An Ingress (or the newer Gateway API) handles external HTTP(S) traffic.
A deployment and a rolling update
apiVersion: apps/v1
kind: Deployment
metadata: { name: web }
spec:
replicas: 3
selector: { matchLabels: { app: web } }
strategy: { type: RollingUpdate, rollingUpdate: { maxSurge: 1, maxUnavailable: 0 } }
template:
metadata: { labels: { app: web } }
spec:
containers:
- name: web
image: example/web:1.4.2
resources: { requests: { cpu: 200m, memory: 256Mi }, limits: { memory: 512Mi } }
readinessProbe: { httpGet: { path: /healthz, port: 8080 } }
Figure SDA-ADS-07-2 · Rolling update · © forcsguy.com
Probes: readiness decides if a pod receives traffic; liveness decides if it should be restarted; startup gives slow starters time. Requests and limits tell the scheduler how much CPU and memory a pod needs and cap what it can use.
Autoscaling
A Horizontal Pod Autoscaler adds or removes pods by metrics such as CPU or request rate; a cluster autoscaler adds or removes nodes when pods cannot be placed. Scaling is useless without correct resource requests.
Extending Kubernetes: operators and CRDs
A Custom Resource Definition (CRD) adds a new object type (for example PostgresCluster). An operator is a controller that watches those objects and does the operational work (create replicas, take backups, fail over), encoding human runbooks as code. Many databases and brokers ship operators.
Things that often go wrong
Missing readiness probes (traffic to pods not ready), no resource requests (noisy neighbours, evictions), latest image tags (unrepeatable deploys), secrets in plain config, a single replica for a critical service, and running stateful systems without understanding storage and failure behaviour.
Real-world reading
Related reading
- TechWorld with Nana: Docker & KubernetesNana Janashia · TechWorld with NanaYouTube
- AWS Containers BlogAmazon Web Services engineers · Amazon Web ServicesBlogs
- Awesome KubernetesRamit Surana · ramitsuranaGitHub
- Kubernetes ConceptsKubernetes Authors · CNCF / KubernetesDocumentation
Show 6 moreShow fewer
- Kubernetes: IngressKubernetes · CNCF / KubernetesDocumentation
- Docker BlogDocker engineers · DockerBlogs
- DevOps Roadmaproadmap.sh community · roadmap.shCourses
- Kubernetes BlogKubernetes community · CNCF / KubernetesBlogs
- From bare-metal to Kubernetes at BetabrandBetabrand engineers · BetabrandCase Studies
- Large-scale cluster management at Google with Borg (paper)Verma et al. · GooglePapers
Check your understanding
Question 1 of 3
0 correct so far
What is the smallest deployable unit in Kubernetes?
Go deeper
- Kubernetes documentation: concepts by Kubernetes: clear and complete
- Kubernetes the Hard Way by Kelsey Hightower: to see every moving part
Topics covered in this lesson
Practise it: Nodes disappear
Everything below is already set up for this lesson: change the design, run the traffic, and see whether you meet the goal.
- 1The task
- 2Build and test
A node pool fails and takes several pods with it. Orchestration restarts them, but only after the load has already hit the survivors.
Goal: Under 2% errors with 3 servers lost for the test.
Replacements take time to start. The survivors must cope in the meantime.
Try it yourself
Explain how a request from the internet reaches a pod of your web app, and what happens during a rolling update.
Click what a strong design here would need:
More in Distributed systems
© 2026 forcsguy.com. Original lesson text and diagrams. Books and sites linked above belong to their authors.