What is Kubernetes (K8s)?
☸️ What is Kubernetes (K8s)?
Kubernetes is an open-source container orchestration platform used to deploy, manage, scale, and run containerized applications automatically.
In simple words:
Kubernetes manages containers for you, so your applications run reliably, scale easily, and recover from failures automatically.
“K8s” = K + 8 letters + s
🧠 Why Kubernetes is Needed?
Before Kubernetes:
- Apps ran on single servers
- Manual deployment & scaling
- Downtime during failures
- Hard to manage many containers
With Kubernetes:
- Automatic scaling
- Self-healing
- Zero / minimal downtime
- Efficient resource usage
- Cloud-native architecture
🐳 Kubernetes vs Docker
DockerKubernetesCreates containersManages containersSingle host focusMulti-node clustersManual scalingAuto-scalingNo self-healingSelf-healing
👉 Docker builds containers, Kubernetes runs and manages them at scale
🧩 Core Kubernetes Architecture
1️⃣ Control Plane (Master Node)
Controls the entire cluster.
Components:
- API Server – Entry point (kubectl talks to this)
- Scheduler – Decides where pods run
- Controller Manager – Ensures desired state
- etcd – Key-value database (cluster state)
2️⃣ Worker Nodes
Run application workloads.
Components:
- kubelet – Node agent
- kube-proxy – Networking & service routing
- Container Runtime – Docker / containerd
📦 Core Kubernetes Objects
🟦 Pod
- Smallest deployable unit
- One or more containers
- Shared network & storage
🟦 Deployment
- Manages replicas of pods
- Handles rolling updates & rollbacks
🟦 Service
- Exposes pods to network
- Types:
- ClusterIP
- NodePort
- LoadBalancer
🟦 ReplicaSet
- Ensures desired number of pods are running
🟦 Namespace
- Logical separation inside cluster
🔁 Kubernetes Self-Healing Features
- Restart failed containers
- Replace crashed pods
- Reschedule pods if node fails
- Health checks (liveness/readiness)
📈 Scaling in Kubernetes
Horizontal Pod Autoscaler (HPA)
- Scales pods based on CPU/memory
Manual Scaling
kubectl scale deployment app --replicas=5
🌐 Kubernetes Networking (Simple)
- Every pod gets a unique IP
- Pods can talk to each other
- Services provide stable access
- Ingress manages HTTP/HTTPS routing
💾 Storage in Kubernetes
- Volume – Temporary storage
- PersistentVolume (PV) – Cluster storage
- PersistentVolumeClaim (PVC) – Request storage
- Works with AWS EBS, Azure Disk, NFS, etc.
🔐 Security in Kubernetes
- RBAC (Role-Based Access Control)
- Namespaces isolation
- Secrets & ConfigMaps
- Network Policies
- Pod Security Standards
🧪 Kubernetes Use Cases
- Microservices architecture
- Cloud-native applications
- CI/CD pipelines
- High-availability systems
- DevOps & SRE environments
🧰 Kubernetes Commands (Basic)
kubectl get pods
kubectl get nodes
kubectl describe pod pod-name
kubectl logs pod-name
kubectl apply -f deployment.yaml
🧠 Kubernetes in Real World
Used by:
- Amazon (EKS)
- Microsoft (AKS)
- Netflix
- Uber