notesonly.in

One notebook for every subject — open it anywhere.

Log in

Orchestration and Kubernetes Basics With easy examples.

Kubernetes (often written K8s) is an open-source system for running containers at scale. If Docker lets you run one container, Kubernetes manages hundreds or thousands of them across many servers: it decides where each container runs, restarts the ones that fail, spreads traffic across them, and adds more when demand rises. It was created by Google and is now the industry standard for container orchestration.

It matters because modern apps are dozens of small services — unmanageable by hand at scale. Kubernetes turns servers into one self-healing, self-scaling computer, letting companies deploy many times a day without downtime and survive traffic spikes.

Key Concepts

  • Cluster: a set of machines (nodes) managed by Kubernetes as one unit.
  • Node: a worker machine running containers; the control plane is the decision-making brain.
  • Pod: the smallest unit Kubernetes manages — usually one container. Pods are temporary and replaceable.
  • Deployment: a description of how many pod replicas should run and which image they use — Kubernetes keeps reality matching it.
  • Service: a stable network address in front of pods, so traffic reaches them as pods come and go.
  • kubectl: the command-line tool used to talk to a cluster — create, inspect, and update everything.

How It Works

  1. You describe what you want in a YAML file: for example, "run 3 copies of my web app image, version 2.0."
  2. You send it to the cluster with kubectl. The control plane records this desired state.
  3. The scheduler picks the best nodes for the new pods, based on available CPU and memory.
  4. Each node's agent (called kubelet) pulls the image and starts the containers.
  5. Kubernetes watches constantly: crashed pods get replaced, the autoscaler adds pods as traffic grows, and image updates roll out pod by pod with no downtime.

Worked Example

Your app runs 3 pod replicas, each handling 100 requests/second: capacity = 3 × 100 = 300 requests/second. A sale pushes traffic to 450/second — 150 over capacity. The autoscaler adds pods: 450 ÷ 100 = 4.5, so 5 pods (500/second capacity). After the sale, traffic falls to 180: 180 ÷ 100 = 1.8, rounded up to 2 pods. You pay for exactly the capacity each moment needs.

Common Misconceptions

  • "Kubernetes is only for huge companies." Small teams use managed Kubernetes (like Google GKE or AWS EKS) or lightweight versions (k3s, minikube) for learning and small apps. The concepts help at any size.
  • "Kubernetes replaces Docker." No — Kubernetes orchestrates containers, and Docker (or containerd) is the engine that actually runs them on each node. They work together.
  • "Pods keep their data." Pods are disposable by design. If a pod dies, its local files die with it. Databases and files that must survive use persistent volumes attached to the cluster, not pod storage.

Real-World Applications

Kubernetes runs Spotify, Airbnb, banks, and telecoms — tens of thousands of containers. Managed services (GKE, EKS) remove control-plane maintenance. It is the backbone of CI/CD at scale: every merge can roll out automatically. Students learn real-world cloud behaviour with minikube on a laptop before spending on cloud accounts.

To recap: Kubernetes is the autopilot for containers — you declare how many copies of your app should run, and the cluster schedules, heals, load-balances, and scales them. Pods are the workers, deployments define the plan, services give stable addresses, and kubectl is how you talk to it all.