Skip to main content

Command Palette

Search for a command to run...

Kubernetes 101: From "What is this?" to Your First Cluster

A practical, no-fluff introduction to the world's most popular container orchestrator.

Published
5 min read
Kubernetes 101: From "What is this?" to Your First Cluster
G

DevOps Engineer | 4 Years of Experience | K8s & Cloud Advocate Documenting my journey through the cloud-native wilderness. I turn my production-level challenges into step-by-step tutorials for the modern engineer. Exploring the "how" and "why" behind Kubernetes, Docker, and beyond. ☸️ 🐳 🚀

Kubernetes is a container orchestration tool used to manage containers. Kubernetes help solve the issues around managing multiple containers that cannot be easily managed using docker compose. Kubernetes helps manage scaling, self healing, networking etc. Kubernetes is often abbreviated as K8s.

Kubernetes has two major components;

  • Control Plane/Master node

  • Worker Node

The Control Plane

This is also known as the Master node. It is the administrative part/brain of Kubernetes. It contains all administrative components.

Components of the Control Plane

  • API Server

  • Etcd

  • Scheduler

  • Controller Manager

API SERVER

This is the entrypoint of the control plane. Every request passes through the API server before reaching other components. It tells other components what to do. Other components watch the API Server for changes.

ETCD

This is a key-value distributed datastore of the k8s node. it is where all the information of the cluster are stored. It plays a vital role.

SCHEDULER

The scheduler constantly checks the state of the control plane all the time to ensure no pending requests. It helps schedules pods on a node based on the request elements that is the resource requirements. It checks the request details and checks for a node that can accommodate that request.

CONTROLLER MANAGER

The controller manager manages all the controllers to ensure they are healthy. There are several types of controller; the namespace controller, deployment controller, node controller etc

The Worker Node

This is where the actual works happens. In most cloud kubernetes providers, the worker node is the only part the user can manage while the providers manage other components.

Components of the Worker Node

  • Kubelet

  • Kube Proxy

  • The Container Runtime

  • Pod

KUBELET

This is a node based agent that receives request from apiserver. It enables communication between worker node and the control plane.

KUBE-PROXY

This is the networking component. It enables networking within the nodes and allows pods to communicate with each other. It also creates iptable rules that enables pod to pod networking.

CONTAINER RUNTIME

This is the software responsible for running the containers. Examples include containerd or CRI-O

POD

This is the smallest deployable unit in kubernetes. Containers are not deployed directly, the pods are deployed and it wraps one or more containers.

A Day in the Life of a Deployment

When a command like kubectl apply -f deployment.yaml is run, here is the chain reaction that occurs:

  • The Handshake (API Server): The request hits the API Server. It validates that the user is who he says he is (this process is known as Authentication) and that he is allowed to run the command (this is known as Authorization).

  • The Record (etcd): Once validated, the API Server defines the "Desired State" and stores it in etcd which is the datastore. It basically says, "Hey, we are officially supposed to have 3 Nginx pods running."

  • The Brainstorm (Scheduler): The Scheduler notices a new request in the API Server with no node assigned. It looks at your Worker Nodes, checks their available CPU/RAM, and picks the best fit. It then updates the API Server with its decision.

  • The Order (Kubelet): The Kubelet on the chosen Worker Node is constantly watching the API Server. It sees: "Oh, I'm supposed to run a Pod!"

  • The Execution (Container Runtime): The Kubelet tells the Container Runtime (like Docker or containerd) to pull the image and start the container.

  • The Map (Kube-Proxy): Finally, Kube-proxy updates the local networking rules so that traffic can actually find the new Pod.

Should you actually use Kubernetes?

Kubernetes is powerful, but it’s famously complex. Before migrating every project to a cluster, it’s important to weigh the pros and cons.

The Pros

  • Self-Healing: If a container crashes, Kubernetes automatically restarts it. If a whole server (node) dies, K8s moves those containers to a healthy server without you lifting a finger.

  • Scalability: With the Horizontal Pod Autoscaler (HPA), K8s can automatically add more copies of an app during a spike in traffic and remove them when things quiet down.

  • No Vendor Lock-in: Kubernetes works the same on AWS, Azure, Google Cloud, or your own physical hardware. This makes it easy to move "cloud-native" apps anywhere.

  • Resource Efficiency: K8s packs containers onto servers in the most efficient way possible to save you money on cloud costs.

The Cons

  • Steep Learning Curve: You have to learn YAML, networking, security policies, and new CLI tools just to get started.

  • Overkill for Small Apps: If you’re just running a simple WordPress site or a small API or few containers, the "tax" of running the Kubernetes control plane might cost more (in money and time) than the app itself.

  • Operational Overhead: Even with "Managed" services like EKS or GKE, you still have to manage cluster upgrades, security patches, and complex networking.

Decision Matrix: K8s vs. Docker Compose

FeatureDocker ComposeKubernetes
Setup SpeedMinutesDays/Weeks
ScalingManualAutomatic
Self-HealingMinimalRobust
Best ForLocal Dev / Small ProjectsProduction / Large Scale

Pro-Tip:

If you can run your entire app on a single server and you don't mind a few minutes of downtime for updates, stick with Docker Compose. If you need "five nines" (99.999%) of uptime and have multiple teams deploying daily, Kubernetes is your best friend.


Thank you for reading, this blog post was inspired by #40daysofkuberneteschallenge by Piyush. Check out his YouTube Channel to join or learn more