Posted in

πŸš€ Introduction to Kubernetes (K8s)

πŸ“Œ What is Kubernetes (K8s)?

Kubernetes (K8s) is an open-source container orchestration platform designed to automate deployment, scaling, and management of containerized applications.

It was originally developed by Google and later donated to the Cloud Native Computing Foundation (CNCF).

In simple terms:

Docker helps you create and run containers.
Kubernetes helps you manage containers at scale.

K8s ensures your application:

  • Runs reliably
  • Scales automatically
  • Recovers from failures
  • Distributes traffic efficiently

πŸ€” Why Was Kubernetes Needed If Docker Already Existed?

Many developers ask this question.

🐳 What Docker Does

Docker allows you to:

  • Package applications into containers
  • Run containers on a single machine
  • Ensure consistent environments

But when your application grows…

🚨 Problems with Docker Alone

Imagine:

  • 100+ containers
  • Multiple servers
  • High traffic
  • Server crashes
  • Load balancing needs

Docker alone cannot:

  • Automatically restart failed containers
  • Distribute traffic across containers
  • Scale containers based on CPU usage
  • Manage containers across multiple machines efficiently

That’s where Kubernetes comes in.


πŸ”₯ What Kubernetes Solves

Kubernetes acts like a container manager + cluster manager + auto-healing system.

It helps with:

  • βœ… Automatic scaling
  • βœ… Self-healing (restarts failed containers)
  • βœ… Load balancing
  • βœ… Rolling updates & rollbacks
  • βœ… Service discovery
  • βœ… Resource management

So while Docker runs containers, Kubernetes orchestrates them across multiple machines.


🌟 Key Features of Kubernetes

1️⃣ Auto Scaling

Automatically increases or decreases pods based on traffic.

2️⃣ Self-Healing

If a container crashes, Kubernetes:

  • Restarts it
  • Replaces it
  • Reschedules it to another node

3️⃣ Load Balancing

Distributes incoming traffic evenly across containers.

4️⃣ Rolling Updates

Deploy new versions without downtime.

5️⃣ Rollbacks

Revert to previous version if something breaks.

6️⃣ Secret & Config Management

Stores passwords, tokens, and configs securely.


πŸ“š Important Kubernetes Terminologies

πŸ”Ή 1. Cluster

A collection of machines (nodes) running containerized applications.

πŸ”Ή 2. Node

A physical or virtual machine inside a cluster.

πŸ”Ή 3. Pod

The smallest deployable unit in Kubernetes.
It contains one or more containers.

πŸ”Ή 4. Deployment

Defines how pods should be created and updated.

πŸ”Ή 5. Service

Exposes pods to internal or external traffic.

πŸ”Ή 6. Namespace

Logical separation inside a cluster.

πŸ”Ή 7. ReplicaSet

Ensures a specified number of pod replicas are running.


πŸ–₯️ Types of Nodes in Kubernetes

A Kubernetes cluster mainly consists of:


1️⃣ Master Node (Control Plane)

The brain of Kubernetes.

It manages:

  • API Server
  • Scheduler
  • Controller Manager
  • etcd (cluster database)

Responsibilities:

  • Decides where pods run
  • Maintains cluster state
  • Monitors health

2️⃣ Worker Node

The machine where applications actually run.

Contains:

  • Kubelet
  • Kube-proxy
  • Container runtime (like Docker or containerd)

Responsibilities:

  • Runs containers
  • Reports status to master node
  • Handles networking

πŸ—οΈ Kubernetes Architecture Overview

  • Master Node β†’ Manages everything
  • Worker Nodes β†’ Run applications
  • Pods β†’ Contain containers
  • Services β†’ Expose applications

πŸ†š Docker vs Kubernetes (Quick Comparison)

FeatureDockerKubernetes
PurposeRun containersOrchestrate containers
ScalingManualAutomatic
Load BalancingLimitedBuilt-in
Self-HealingNoYes
Multi-Node SupportBasicAdvanced

🎯 Real-World Example

Imagine you built a Spring Boot microservices application (like a chat app with auth, gateway, user, chat services).

Instead of manually:

  • Starting containers
  • Restarting failed services
  • Managing scaling

Kubernetes:

  • Automatically deploys each microservice
  • Ensures required replicas are running
  • Scales based on traffic
  • Restarts failed pods

This is why Kubernetes is essential in modern microservices architecture.


🏁 Conclusion

Kubernetes (K8s) is not a replacement for Docker β€”
It is an evolution for managing containers at scale.

If Docker is the engine πŸš—
Kubernetes is the traffic controller 🚦

In today’s cloud-native world, Kubernetes has become the standard platform for deploying scalable, resilient applications.


Leave a Reply

Your email address will not be published. Required fields are marked *