π DevOps Week 6 - Complete Kubernetes Fundamentals Guide βΈοΈ Part - 1
Learn Introduction to Kubernetes, Architecture, Cluster Management, Pods, Deployments, ReplicaSets, Services & Networking in Simple Language π

πΉ 1. What is Kubernetes? βΈοΈ
Kubernetes (K8s) is a container orchestration platform.
π It is used to:
Deploy containers
Manage containers
Scale containers
Monitor containers
automatically in production environments.
πΉ 2. Why Kubernetes is Important? π₯
In modern companies:
Applications are built using microservices
Hundreds or thousands of containers run together
Managing them manually becomes difficult.
π Kubernetes automates this entire process.
πΉ 3. Prerequisite for Kubernetes π
Before learning Kubernetes, you should understand:
β Docker β Containers β Networking basics β Container isolation
π‘ Important Point
The instructor explains: π Donβt just memorize Docker commands.
Instead understand:
How containers work
Namespace isolation
Networking
Container lifecycle
because Kubernetes works on top of containers.
πΉ 4. Docker vs Kubernetes βοΈ
β Docker
Docker is a:
Container Platform
Used to:
Build containers
Run containers
β Kubernetes
Kubernetes is a:
Container Orchestration Platform
Used to:
Manage large-scale containers
Automate operations
Handle production workloads
πΉ 5. Problems with Docker in Production β
Docker is excellent for running containers.
But in large production systems, Docker alone has limitations.
Kubernetes solves these problems.
πΉ 6. Problem 1 β Single Host Limitation π₯οΈ
β Docker Problem
Docker usually works on:
Single Host
Meaning:
- Containers run on one server only.
π‘ Problem Scenario
If:
Server crashes
CPU becomes overloaded
Applications may go down.
β Kubernetes Solution
Kubernetes uses:
Cluster Architecture
A cluster = Multiple servers (nodes)
β Benefits
If one server fails: π Kubernetes moves workload to another server automatically.
πΉ 7. Problem 2 β Auto Healing π
β Docker Problem
If a container crashes: π Manual restart required.
β Kubernetes Solution
Kubernetes continuously monitors containers.
If a container fails: β Automatically creates new container.
β This Feature is Called:
Auto Healing
πΉ 8. Problem 3 β Auto Scaling π
β Docker Problem
Handling sudden traffic spikes is difficult manually.
Example:
Website traffic increases rapidly
One container cannot handle load
β Kubernetes Solution
Kubernetes supports:
Horizontal Pod Autoscaling (HPA)
β What Happens?
Kubernetes automatically:
Adds more containers when traffic increases
Removes extra containers when traffic decreases
β Benefits
β Better performance β Cost optimization β High availability
πΉ 9. Problem 4 β Enterprise-Level Features π’
β Docker Limitation
Docker is minimalistic.
Large enterprises require:
Load balancing
Security
API gateways
Firewalling
Monitoring
β Kubernetes Solution
Kubernetes provides enterprise-level capabilities.
β Features Include
β Load balancing β Service discovery β Networking β Security policies β Scalability β High availability
πΉ 10. Kubernetes Origin π
Kubernetes was inspired by:
Google Borg Project
Google used Borg internally to manage massive infrastructure.
Kubernetes brings similar concepts to modern cloud environments.
πΉ 11. Kubernetes Cluster Architecture βΈοΈ
Kubernetes works using:
Master Node
Worker Nodes
β Worker Nodes
Run applications/containers.
β Master Node
Controls the cluster:
Scheduling
Monitoring
Management
πΉ 12. What is a Pod? π¦
Kubernetes does not directly run containers.
Instead it runs:
Pods
A Pod contains:
- One or more containers
πΉ 13. Why Kubernetes is Popular? π
β Automation
Reduces manual work.
β Scalability
Handles traffic automatically.
β Reliability
Auto-healing improves uptime.
β Cloud Native
Works well with:
AWS
Azure
GCP
πΉ 14. Real DevOps Use Cases π‘
β Microservices Architecture
Different services deployed independently.
β Large Applications
Used by:
Netflix
Spotify
Google
Amazon
β CI/CD Pipelines
Kubernetes integrates with DevOps automation tools.
πΉ 15. Kubernetes Future Learning π
Upcoming Kubernetes concepts include:
Pods
Deployments
Services
Ingress Controllers
ConfigMaps
Secrets
πΉ 16. Docker vs Kubernetes Summary π₯
| Docker | Kubernetes |
|---|---|
| Container platform | Orchestration platform |
| Single host | Multi-node cluster |
| Manual recovery | Auto healing |
| Limited scaling | Auto scaling |
| Basic features | Enterprise-ready |
πΉ 17. Important Interview Questions π₯
β What is Kubernetes?
Container orchestration platform.
β Why Kubernetes?
To manage containers automatically at scale.
β Difference between Docker & Kubernetes?
Docker runs containers. Kubernetes manages containers.
β What is Auto Healing?
Automatically recreating failed containers.
β What is HPA?
Horizontal Pod Autoscaler.
Automatically scales pods based on traffic
Kubernetes Architecture Explained with Examples
πΉ 1. What is Kubernetes Architecture? βΈοΈ
Kubernetes architecture defines:
How Kubernetes manages applications
How containers communicate
How workloads are distributed
Kubernetes works using:
Control Plane + Worker Nodes
πΉ 2. Two Main Parts of Kubernetes Architecture ποΈ
| Part | Purpose |
|---|---|
| Control Plane | Manages cluster |
| Data Plane (Worker Nodes) | Runs applications |
πΉ 3. Understanding with Real-Life Example π‘
Imagine:
π§ Control Plane = School Principal π¨βπ« Worker Nodes = Classrooms π¨βπ Containers = Students
The principal:
Gives instructions
Manages classrooms
Decides student allocation
The classrooms:
- Actually run daily activities
Similarly:
Control Plane manages
Worker Nodes execute
πΉ A. Data Plane (Worker Nodes) π₯οΈ
Worker nodes are responsible for: β Running applications β Executing containers β Managing workloads
Each worker node contains 3 important components.
πΉ a. Container Runtime π¦
Examples:
containerD
CRI-O
Docker (older setups)
β Purpose
Container runtime is responsible for:
Running containers
β Real-Life Example
Like:
Engine of a car
Without engine:
- Car cannot run
Without container runtime:
- Containers cannot run
πΉ b. Kubelet π₯
Kubelet is the:
Primary agent on worker node
β Responsibilities
Kubelet:
Talks to control plane
Starts containers
Monitors pods
Ensures containers stay running
β Real-Life Example
Kubelet acts like:
Class monitor
It continuously checks:
Is application running properly?
Did any pod fail?
β Important Point
If a pod crashes: π Kubelet helps restart it.
πΉ c. Kube-Proxy π
Kube-Proxy handles:
Networking
Communication
Load balancing
between pods/services.
β Responsibilities
β Assigns IP addresses β Routes traffic β Enables pod communication
β Real-Life Example
Kube-Proxy works like:
Traffic police
Directing traffic properly between applications.
πΉ B. Control Plane (Master Node) π§
The control plane is:
Brain of Kubernetes
It manages the entire cluster.
πΉ a. API Server β€οΈ
API Server is:
Heart of Kubernetes
β Responsibilities
All requests first go to:
API Server
Examples:
kubectl commands
UI requests
Internal communication
β Real-Life Example
Like:
Reception desk of office
Every request first reaches reception.
πΉ b. Scheduler π
Scheduler decides:
Where pods should run
β How Scheduler Works
It checks:
CPU usage
Memory availability
Resource health
Then selects best worker node.
β Example
If:
Node 1 overloaded
Node 2 free
Scheduler places pod on Node 2.
πΉ c. etcd ποΈ
etcd is:
Key-value database
β Purpose
Stores:
Cluster configuration
Node information
Pod details
Secrets
Current cluster state
β Important Point
etcd is called:
Source of Truth
because Kubernetes stores all important data here.
β Real-Life Example
Like:
School records database
Stores complete information.
πΉ d. Controller Manager π
Controller Manager ensures:
Desired state = Actual state
β Example
Suppose: You want:
3 pods running
If 1 pod crashes: π Controller Manager creates new pod automatically.
β Responsibilities
β Monitoring β Auto healing β Replica management
πΉ e. Cloud Controller Manager (CCM) βοΈ
Used mainly in:
AWS
Azure
GCP
β Purpose
Connects Kubernetes with cloud provider APIs.
β Example
If Kubernetes needs:
Load balancer
Storage
Public IP
CCM talks to cloud provider.
β Real-Life Example
Like:
Translator between Kubernetes and Cloud
πΉKubernetes Workflow π
β Step-by-Step Flow
Step 1
User sends request using:
kubectl apply
Step 2
Request goes to:
API Server
Step 3
Scheduler selects worker node.
Step 4
Kubelet receives instruction.
Step 5
Container Runtime starts container.
Step 6
Kube-Proxy handles networking.
πΉ Kubernetes Architecture Diagram (Simple Flow) π
User
β
API Server
β
Scheduler
β
Worker Node
β
Kubelet
β
Container Runtime
β
Pods Running
πΉWhy Kubernetes Architecture is Powerful? π
β High Availability
Applications stay available.
β Auto Healing
Failed pods restart automatically.
β Scalability
Easily handles traffic spikes.
β Enterprise Ready
Supports:
Monitoring
Security
Load balancing
πΉ Control Plane vs Worker Node βοΈ
| Control Plane | Worker Node |
|---|---|
| Manages cluster | Runs applications |
| Makes decisions | Executes tasks |
| Brain of Kubernetes | Work machine |
| Handles scheduling | Runs pods |
πΉImportant Interview Questions π₯
β What is Control Plane?
Manages Kubernetes cluster.
β What is Worker Node?
Runs containers and applications.
β What is API Server?
Central communication gateway.
β What is etcd?
Key-value database storing cluster state.
β What is Kubelet?
Agent running on worker nodes.
β What is Scheduler?
Selects best node for pod placement.
β What is Kube-Proxy?
Handles networking and load balancing.
How to Manage Hundreds of Kubernetes Clusters? βΈοΈπ
πΉ Why Managing Kubernetes Clusters is Difficult? π€
In real production environments:
Companies run multiple applications
Applications are distributed across many clusters
Infrastructure grows rapidly
Managing everything manually becomes: β Complex β Time-consuming β Error-prone
πΉ Development vs Production Kubernetes βοΈ
β Development Environment
Used for:
Practice
Learning
Testing
Common Development Tools
| Tool | Purpose |
|---|---|
| Minikube | Local Kubernetes cluster |
| kind | Kubernetes in Docker |
| k3s | Lightweight Kubernetes |
Important Note
These tools are:
NOT recommended for production
because they are mainly designed for local learning and testing.
β Production Environment
Production systems require: β High availability β Security β Scalability β Enterprise support β Monitoring β Backup & recovery
πΉ What Do Companies Use in Production? π’
Instead of raw Kubernetes, organizations use:
Kubernetes Distributions
πΉ What is a Kubernetes Distribution? π¦
A Kubernetes distribution is:
Production-ready Kubernetes package
with:
Security features
Monitoring
Management tools
Enterprise support
πΉ Popular Kubernetes Distributions π
| Distribution | Provider |
|---|---|
| OpenShift | Red Hat |
| Rancher | SUSE |
| VMware Tanzu | VMware |
| EKS | AWS |
| AKS | Azure |
| GKE | Google Cloud |
πΉ Why Managed Kubernetes is Popular? βοΈ
Managed services like:
AWS EKS
Azure AKS
Google GKE
reduce operational burden.
Cloud Provider Handles
β Control plane management β Upgrades β High availability β Security patches
DevOps Engineer Focuses On
β Applications β Deployments β Scaling β Monitoring
πΉ What is KOPS? βοΈ
KOPS stands for:
Kubernetes Operations
Purpose of KOPS
KOPS helps manage:
Kubernetes cluster creation
Upgrades
Configuration
Deletion
πΉ Why KOPS is Important? π
In enterprises:
- Hundreds of clusters may exist
Manually handling them is impossible.
KOPS automates cluster lifecycle management.
πΉ Real DevOps Use Case π‘
Suppose a company has:
100 microservices
Multiple regions
Separate dev/staging/prod clusters
KOPS helps: β Create clusters quickly β Maintain consistency β Simplify operations
πΉ KOPS Workflow π
β Install Required Tools
Required tools:
AWS CLI
Python 3
kubectl
KOPS
β Configure AWS
Need: β AWS IAM permissions β AWS credentials
β Create S3 Bucket
KOPS uses:
S3 bucket as state storage
Why S3 Bucket?
Stores:
Cluster configuration
Metadata
State information
β Create Cluster
KOPS uses commands to:
Create cluster
Configure networking
Launch EC2 instances
β Validate Cluster
After creation:
kubectl get nodes
checks whether cluster is running properly.
πΉ Why S3 State Store is Important? ποΈ
KOPS continuously tracks:
Cluster state
Infrastructure changes
using S3 storage.
Benefits
β Backup β Easy recovery β Centralized management
πΉ Important Production Concepts π₯
β High Availability
Production clusters require:
Multiple nodes
Redundancy
Failover systems
β Security
Clusters must secure:
APIs
Networking
Secrets
IAM access
β Monitoring
Production environments use:
Prometheus
Grafana
ELK Stack
β Scaling
Clusters should automatically:
Scale applications
Handle traffic spikes
πΉ Cost Warning β οΈ
The instructor clearly mentions:
Creating Kubernetes clusters on AWS:
WILL incur charges
β Recommendation for Beginners
Use:
Minikube
kind
k3s
for local practice.
πΉ Why Minikube is Good for Beginners? π»
Minikube: β Runs locally β Free for learning β Easy to install β Good for practice
πΉ Real-World DevOps Responsibilities π¨βπ»
A DevOps Engineer may handle:
Cluster upgrades
Security patches
Node management
Monitoring
Disaster recovery
Scaling infrastructure
πΉ Difference Between Minikube & EKS βοΈ
| Minikube | AWS EKS |
|---|---|
| Local learning | Production-grade |
| Single node | Multi-node cluster |
| Free/local | Paid cloud service |
| Beginner practice | Enterprise usage |
πΉ Important Commands Mentioned π§Ύ
β Check Kubernetes Nodes
kubectl get nodes
β Create Cluster with KOPS
kops create cluster
β Update Cluster
kops update cluster
β Validate Cluster
kops validate cluster
πΉ Important Interview Questions π₯
β What is KOPS?
Tool used to manage Kubernetes cluster lifecycle.
β Why use Kubernetes distributions?
Provides production-ready Kubernetes with enterprise support.
β Why is Minikube not used in production?
It is designed only for local development/testing.
β What is EKS?
Managed Kubernetes service by AWS.
β Why use S3 bucket in KOPS?
To store cluster state and configuration.
Kubernetes Pods | Deploy Your First App βΈοΈ
πΉ Introduction to Kubernetes Pods βΈοΈ
Kubernetes uses:
Pods
to run applications.
A Pod is the:
Smallest deployable unit in Kubernetes
Instead of directly managing containers, Kubernetes manages Pods.
πΉ Why Kubernetes Uses Pods? π€
In Docker:
- We directly run containers.
But Kubernetes introduces:
Pods as wrappers around containers
This provides: β Better orchestration β Easier scaling β Auto healing β Better networking β Enterprise-level management
πΉ What is a Pod? π¦
A Pod is:
A wrapper that contains one or more containers
πΉ Simple Real-Life Example π‘
Imagine:
π¦ Container = Mobile App π± Pod = Mobile Phone
The app runs inside the phone.
Similarly:
- Containers run inside Pods.
πΉ Container vs Pod βοΈ
| Container | Pod |
|---|---|
| Runs application | Wraps container |
| Docker manages it | Kubernetes manages it |
| Lightweight runtime | Smallest deployable unit |
| Independent | Can contain multiple containers |
πΉ Why Pods are Important? π
Pods help Kubernetes provide: β Auto scaling β Auto healing β Networking β Resource management β Service discovery
πΉ Single Container Pod π¦
Most commonly:
1 Pod = 1 Container
Example:
- One Nginx container inside one Pod.
πΉ Multi-Container Pod π§©
Sometimes:
1 Pod = Multiple Containers
Used when containers must:
Share storage
Share networking
Work closely together
πΉ What is kubectl? π οΈ
kubectl is:
Command Line Interface for Kubernetes
Used to:
Create resources
Manage Pods
Check logs
Debug issues
πΉ What is Minikube? π»
Minikube is:
Local Kubernetes cluster
used for:
Practice
Learning
Testing Kubernetes locally
πΉ Why Minikube is Good for Beginners? π
Minikube: β Easy to install β Free for learning β Runs locally β Good for Kubernetes practice
πΉ Installing Kubernetes Tools π§
The video demonstrates installing:
kubectl
Minikube
These tools are required for:
Running Kubernetes locally
πΉ Creating Your First Kubernetes App π
Applications in Kubernetes are usually created using:
YAML files
πΉ What is YAML? π
YAML is:
Configuration language
used to define:
Pods
Deployments
Services
Configurations
πΉ Example Pod YAML File π
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
spec:
containers:
- name: nginx-container
image: nginx
πΉ Understanding the YAML File π§
| Field | Purpose |
|---|---|
| apiVersion | Kubernetes API version |
| kind | Resource type |
| metadata | Pod name/details |
| spec | Container configuration |
| image | Docker image name |
πΉ Deploying the Pod π
Command used:
kubectl create -f pod.yaml
πΉ What This Command Does? π€
It tells Kubernetes: β Read YAML file β Create Pod β Pull Docker image β Start container inside Pod
πΉ Checking Running Pods π
Command:
kubectl get pods
πΉ Output Example
NAME READY STATUS RESTARTS
nginx-pod 1/1 Running 0
πΉ Important Debugging Commands π οΈ
Kubernetes debugging is very important for DevOps engineers.
πΉ Describe Pod Command π
kubectl describe pod nginx-pod
β Purpose
Shows:
Pod events
Status
Errors
Networking details
Resource information
πΉ Logs Command π
kubectl logs nginx-pod
β Purpose
Used to:
View application logs
Debug application issues
Detect failures/errors
πΉ Common Pod Problems β οΈ
Sometimes Pods may fail because of:
Wrong image name
Port issues
Insufficient resources
Application crash
πΉ Why Debugging is Important? π₯
DevOps engineers frequently troubleshoot: β Failed Pods β CrashLoopBackOff errors β Networking issues β Resource issues
πΉ Pod Lifecycle π
Basic lifecycle:
Create Pod
β
Image Pull
β
Container Start
β
Running State
β
Stopped/Deleted
πΉ Why Pods Alone Are Not Enough? π€
Pods are foundational, but in production companies prefer:
Deployments
because Pods alone do not provide: β Auto healing β Auto scaling β Replica management
πΉ What are Deployments? π
Deployments help: β Automatically recreate failed Pods β Scale applications β Manage updates/rollbacks
πΉ Kubernetes vs Docker π
| Docker | Kubernetes |
|---|---|
| Runs containers | Orchestrates containers |
| Manual scaling | Auto scaling |
| Limited auto healing | Built-in auto healing |
| Single host focus | Cluster management |
πΉ Real DevOps Use Cases π‘
Kubernetes Pods are used for:
Hosting web applications
Running APIs
Microservices deployment
Backend services
CI/CD applications
πΉ Important Interview Questions π₯
β What is a Pod?
Smallest deployable unit in Kubernetes.
β Difference between Pod and Container?
Pod wraps one or more containers.
β What is kubectl?
CLI tool used to manage Kubernetes.
β What is Minikube?
Local Kubernetes cluster for learning/testing.
β How to check Pod logs?
kubectl logs <pod-name>
β How to describe Pod details?
kubectl describe pod <pod-name>
Kubernetes Deployments & ReplicaSets βΈοΈπ
πΉ Introduction to Kubernetes Deployments π
In Kubernetes, Pods are the smallest deployable units.
But in real production environments:
Pods are rarely managed directly
Instead, organizations use:
Deployments
because Deployments provide: β Auto healing β Scaling β High availability β Rolling updates β Zero downtime
πΉ Container vs Pod vs Deployment βοΈ
Understanding this hierarchy is very important.
β Container π¦
A container:
Runs the application
Example:
Nginx container
Python app container
β Pod βΈοΈ
A Pod:
Wraps one or more containers
It provides:
Shared networking
Shared storage
Kubernetes management
β Deployment π
A Deployment:
Manages Pods automatically
It ensures:
Correct number of Pods
Auto recovery
Scaling
Smooth updates
πΉ Simple Real-Life Example π‘
Imagine:
π¨βπ³ Container = Chef π½οΈ Pod = Kitchen π’ Deployment = Restaurant Manager
The manager:
Ensures enough kitchens exist
Replaces failed kitchens
Handles scaling during rush hours
Similarly: Deployments manage Pods automatically.
πΉ Why Pods Alone Are Not Enough? π€
If you directly create Pods: β No automatic recovery β No scaling β No rolling updates β No production reliability
If a Pod crashes:
Application may go down
πΉ What is a Deployment? π
A Deployment is:
A Kubernetes object used to manage Pods
Deployments automatically: β Create Pods β Replace failed Pods β Scale Pods β Update applications safely
πΉ What is a ReplicaSet? π
A ReplicaSet is:
A Kubernetes controller
that ensures:
Desired number of Pods are always running
πΉ Important Relationship π§
Deployment β Creates ReplicaSet β Manages Pods
πΉ Deployment Architecture π
Deployment
β
ReplicaSet
β
Pods
β
Containers
πΉ What Does ReplicaSet Do? π
ReplicaSet continuously checks:
How many Pods should run
How many Pods are currently running
If mismatch happens: π ReplicaSet fixes it automatically.
πΉ Example of ReplicaSet π‘
Suppose:
Desired replicas = 3
Current running:
Only 2 Pods
ReplicaSet automatically: β Creates 1 more Pod
πΉ Auto-Healing in Kubernetes β€οΈ
One of the biggest advantages of Deployments is:
Auto Healing
β What is Auto Healing?
If a Pod crashes or gets deleted:
ReplicaSet automatically creates a new Pod
without manual intervention.
πΉ Real Production Scenario πΌ
Suppose: Your company website is running on Kubernetes.
If one Pod crashes: β Website should NOT go down.
Kubernetes automatically: β Detects failure β Creates replacement Pod β Keeps application available
πΉ Zero Downtime Deployment π₯
Kubernetes Deployments support:
Zero Downtime Updates
β What Does This Mean?
Applications continue running while:
New Pods are created
Old Pods are removed gradually
Users experience: β No service interruption
πΉ Scaling Applications π
Deployments make scaling easy.
β Example
Initially:
1 Pod running
Traffic increases suddenly.
Deployment can scale:
1 β 3 β 10 Pods
to handle more users.
πΉ Kubernetes Deployment YAML π
Example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
πΉ Understanding Deployment YAML π§
| Field | Purpose |
|---|---|
| apiVersion | Kubernetes API version |
| kind | Resource type |
| replicas | Number of Pods |
| selector | Pod matching label |
| template | Pod definition |
| image | Container image |
πΉ Creating Deployment π
Command:
kubectl create -f deployment.yaml
πΉ Checking Deployments π
Command:
kubectl get deployments
πΉ Checking ReplicaSets π
Command:
kubectl get rs
πΉ Checking Pods βΈοΈ
Command:
kubectl get pods
πΉ Scaling Deployment π
Command:
kubectl scale deployment nginx-deployment --replicas=5
β Result
Kubernetes automatically creates:
5 Pods
πΉ What Happens if Pod Gets Deleted? β οΈ
Suppose: You manually delete one Pod.
ReplicaSet immediately: β Detects missing Pod β Creates replacement Pod
This is:
Auto Healing
πΉ Deployment Benefits π
Deployments provide: β High availability β Auto healing β Easy scaling β Rolling updates β Rollbacks β Zero downtime
πΉ Real DevOps Use Cases πΌ
Deployments are used for:
Web applications
APIs
Microservices
Banking applications
E-commerce platforms
CI/CD applications
πΉ Rolling Updates π
When updating application version: Kubernetes: β Creates new Pods gradually β Removes old Pods safely
This avoids: β Application downtime
πΉ Rollback Feature βͺ
If deployment update fails: Kubernetes can:
Rollback to previous version
very easily.
πΉ Difference Between Pod & Deployment βοΈ
| Pod | Deployment |
|---|---|
| Basic unit | Manages Pods |
| Manual management | Automatic management |
| No scaling | Supports scaling |
| No auto healing | Auto healing |
| Not production-ready | Production-ready |
πΉ Important kubectl Commands π§Ύ
β Create Deployment
kubectl create -f deployment.yaml
β Get Deployments
kubectl get deployments
β Get ReplicaSets
kubectl get rs
β Get Pods
kubectl get pods
β Scale Deployment
kubectl scale deployment nginx-deployment --replicas=5
β Describe Deployment
kubectl describe deployment nginx-deployment
πΉ Important Interview Questions π₯
β What is Deployment in Kubernetes?
Deployment manages Pods automatically.
β What is ReplicaSet?
Controller ensuring desired number of Pods are running.
β What is Auto Healing?
Automatic recreation of failed Pods.
β Why use Deployments instead of Pods?
Deployments provide:
Scaling
Auto healing
Rolling updates
β What is Zero Downtime Deployment?
Application remains available during updates.
Everything About Kubernetes Services βΈοΈπ
πΉ Introduction to Kubernetes Services π
In Kubernetes, applications run inside:
Pods
But Pods are:
Temporary (Ephemeral)
This means:
Pods can crash
Pods can be recreated
Pod IP addresses can change
Because of this:
Direct communication with Pods becomes unreliable
πΉ The Main Problem Without Services β
Suppose: Your application is running inside a Pod.
Users access it using:
Pod IP Address
Now if:
Pod crashes
ReplicaSet creates new Pod
Then:
New Pod gets a NEW IP address
Result: β Users lose connection β Applications become inaccessible
πΉ Why Kubernetes Services Are Needed? π‘
Kubernetes Services solve this issue by providing: β Stable networking β Fixed access point β Load balancing β Service discovery
πΉ What is a Kubernetes Service? βΈοΈ
A Kubernetes Service is:
A stable networking layer in front of Pods
It acts like:
A permanent entry point for applications
Even if Pods change, the Service remains constant.
πΉ Real-Life Example π‘
Imagine:
πͺ Shop workers = Pods π’ Shop reception desk = Service
Customers do NOT directly contact workers.
Instead:
They contact reception
Reception forwards requests
Similarly: Kubernetes Service forwards traffic to Pods.
πΉ Main Functions of Kubernetes Services π₯
Services mainly provide: β Load Balancing β Service Discovery β Stable Access
πΉ What is Load Balancing? βοΈ
Load balancing means:
Distributing traffic across multiple Pods
πΉ Example of Load Balancing π‘
Suppose: You have:
3 Pod replicas
100 users visit the application.
Instead of sending all traffic to one Pod: Kubernetes distributes requests among:
Pod 1
Pod 2
Pod 3
Result: β Better performance β Better reliability β Reduced overload
πΉ Why Load Balancing is Important? π
Without load balancing: β One Pod may crash due to heavy traffic
With load balancing: β Traffic is shared equally
πΉ What is Service Discovery? π
Service discovery means:
Automatically finding Pods dynamically
Because Pod IPs change frequently, Services use:
Labels & Selectors
to identify Pods.
πΉ What are Labels in Kubernetes? π·οΈ
Labels are:
Key-value pairs attached to Pods
Example:
labels:
app: nginx
πΉ What are Selectors? π―
Selectors are used by Services to:
Find matching Pods
Example:
selector:
app: nginx
πΉ How Labels & Selectors Work Together π
Suppose: Pods contain label:
app=nginx
Service selector searches:
app=nginx
Result: β Service automatically connects to matching Pods
πΉ Kubernetes Service Workflow π
User Request
β
Kubernetes Service
β
Load Balancing
β
Matching Pods
πΉ Kubernetes Service YAML Example π
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
πΉ Understanding Service YAML π§
| Field | Purpose |
|---|---|
| kind | Resource type |
| selector | Finds matching Pods |
| port | Service port |
| targetPort | Pod container port |
| type | Service type |
πΉ Types of Kubernetes Services π
Kubernetes mainly provides:
ClusterIP
NodePort
LoadBalancer
πΉ ClusterIP Service π
ClusterIP is:
Default Kubernetes Service type
β Purpose
Allows communication:
ONLY inside the Kubernetes cluster
β Use Cases
Used for:
Internal microservices
Backend APIs
Database communication
β Example
Frontend Pod communicates with Backend Pod internally.
β Access Scope
Internal Cluster Only
πΉ NodePort Service π
NodePort exposes applications using:
Worker Node IP + Port
β Purpose
Allows external access to applications.
β How It Works
Kubernetes opens:
Specific port on every worker node
Users access:
<Node-IP>:<NodePort>
β Use Cases
Useful for:
Testing
Internal organization access
Development environments
β Example
192.168.1.10:30007
πΉ LoadBalancer Service βοΈ
LoadBalancer is:
Cloud-provider integrated service
β Purpose
Exposes application publicly to the internet.
β How It Works
In cloud platforms like:
AWS
Azure
GCP
Kubernetes automatically provisions: β External Load Balancer β Public IP address
β Use Cases
Used for:
Public websites
Production applications
Internet-facing services
πΉ Service Types Comparison βοΈ
| Service Type | Access Scope | Use Case |
|---|---|---|
| ClusterIP | Internal only | Internal communication |
| NodePort | External via Node IP | Testing/Internal access |
| LoadBalancer | Public internet | Production apps |
πΉ Why Services are Important in Production? π
Services provide: β High availability β Stable networking β Scalable architecture β Reliable communication
πΉ Auto-Healing & Services β€οΈ
When Pods fail:
- New Pods get new IPs
But Services automatically: β Detect new Pods β Continue routing traffic
Users never notice backend changes.
πΉ Kubernetes Networking Basics π
Each Pod gets: β Unique IP address
But because Pods are temporary, Services create:
Stable communication layer
πΉ Real DevOps Use Cases πΌ
Services are used in:
E-commerce applications
Banking apps
Microservices architecture
APIs
Kubernetes production clusters
πΉ Example Architecture π‘
Users
β
LoadBalancer Service
β
Frontend Pods
β
ClusterIP Service
β
Backend Pods
β
Database
πΉ Important kubectl Commands π§Ύ
β Get Services
kubectl get svc
β Describe Service
kubectl describe svc nginx-service
β Create Service
kubectl apply -f service.yaml
β Get Pods
kubectl get pods
πΉ Important Interview Questions π₯
β What is a Kubernetes Service?
Stable networking layer for Pods.
β Why are Services needed?
Because Pod IP addresses change dynamically.
β What is Load Balancing?
Distributing traffic across multiple Pods.
β What is Service Discovery?
Automatically identifying Pods using labels/selectors.
β Difference between ClusterIP & NodePort?
ClusterIP is internal only, NodePort allows external access.
β Which Service type exposes application publicly?
LoadBalancer Service.
π Continue Your Learning Journey
Thank you for taking the time to read this article.
Technology is evolving rapidly, and continuous learning is one of the most valuable investments you can make in your career. Whether you're exploring DevOps, Cloud Computing, Artificial Intelligence, Cybersecurity, Software Development, Data Science, or Career Growth, the resources below can help you deepen your knowledge and stay ahead in the industry.
π Recommended Learning Platforms
π Coursera
Learn from world-renowned universities and industry leaders including Google, IBM, Stanford, Microsoft, Meta, and many more.
β Professional Certificates β Career-focused Learning Paths β AI & Machine Learning Programs β Cloud & DevOps Certifications β Business & Leadership Courses
π https://imp.i384100.net/k0KvbV
π» Udemy
One of the largest online learning platforms with practical, hands-on courses covering:
β DevOps & Kubernetes β Docker & Cloud Computing β AWS, Azure & GCP β Programming & Development β Cybersecurity & Ethical Hacking
π https://trk.udemy.com/MAL2MY
π DataCamp
A great platform for anyone interested in:
β Python Programming β SQL & Databases β Data Analytics β Machine Learning β Artificial Intelligence
Interactive learning paths and hands-on projects make it ideal for beginners and professionals alike.
π https://datacamp.pxf.io/nX4kER
π edX
Access high-quality courses and certifications from leading institutions such as:
β Harvard University β MIT β Berkeley β Microsoft
Perfect for learners seeking university-level education online.
π https://edx.sjv.io/POvVeN
π¨ Domestika
Enhance your creative skills with courses on:
β Graphic Design β Video Editing β Animation β Digital Marketing β Content Creation
π https://domestika.sjv.io/dynKAW
π οΈ Recommended Tools & Resources
π₯ AppSumo
Discover exclusive lifetime deals on:
β AI Tools β Productivity Software β Developer Utilities β Marketing Platforms β Business Applications
A must-have resource for developers, creators, freelancers, and entrepreneurs looking to save money while accessing premium tools.
π https://appsumo.8odi.net/L04a33
π Shopify
Looking to start an online business or launch an eCommerce store?
Shopify provides everything you need to build, manage, and scale an online business.
β Online Store Builder β Payment Integration β Inventory Management β Marketing Tools
π https://shopify.pxf.io/Vxv09k
π WordPress, WooCommerce & Jetpack
Create professional websites, blogs, and online stores with one of the most trusted web ecosystems in the world.
Ideal for:
β Personal Blogs β Portfolio Websites β Business Websites β eCommerce Stores
π https://automattic.pxf.io/Z6vR5W
π Language Learning Resources
π£οΈ Preply
Learn English and other languages through personalized one-on-one tutoring sessions with experts from around the world.
π https://preply.sjv.io/o4gBDY
π British Council English Online
Improve your professional communication skills and English fluency through structured learning programs.
π https://englishonline.sjv.io/9VOGa4
π§ Rosetta Stone
One of the most recognized language-learning platforms for immersive language acquisition.
π https://aff.rosettastone.com/X4OyqG
π§ͺ Science & Educational Resources
π¬ MEL Science
Interactive science kits and educational experiences designed to make STEM learning engaging and practical.
π https://imp.i328067.net/bk2beg
π Carson Dellosa Education
Educational materials and learning resources for students, teachers, and lifelong learners.
π https://carsondellosaeducation.sjv.io/E0JbjW
β€οΈ Support My Work
Creating detailed technical content, tutorials, guides, and learning resources takes significant time and effort.
If you find my articles helpful and would like to support my work, you can do so through the following platforms:
β Become a GitHub Sponsor
Support my open-source contributions, technical content, and community projects.
π https://github.com/sponsors/hritikranjan1
β Buy Me a Chai
Enjoying my content? Consider buying me a chai and supporting future tutorials, guides, and educational resources.
π https://www.chai4.me/hritikranjan
π¨βπ» Connect With Me
Hritik Ranjan
π‘ AI Enthusiast βοΈ DevOps Learner π Cybersecurity Advocate π» Software Developer
Connect & Follow
π GitHub: https://github.com/hritikranjan1
π LinkedIn: https://linkedin.com/in/hritikranjan1
π’ Found This Article Helpful?
If this article added value to your learning journey:
β
Share it with your network
β
Bookmark it for future reference
β
Follow for more DevOps, AI, Cloud, Cybersecurity, and Software Engineering content
Thank you for reading and being part of this learning journey.
Keep Learning. Keep Building. Keep Growing. π






