আগের article: Container Orchestration →
আগের article-এ আমরা শিখেছি:
Docker
↓
Container
↓
Many Containers
↓
Kubernetes
↓
Cluster
এখন প্রশ্ন হলো:
এই lecture-এর main concepts:
- Node
- Cluster
- Control Plane / Master
- Worker Node
- API Server
- etcd
- Scheduler
- Controllers
- Container Runtime
- Kubelet
- kubectl
এগুলো Kubernetes architecture-এর core building blocks।
1. Node কী?
একটা Node হলো একটা machine যেখানে Kubernetes-এর components run করে এবং যেখানে workloads run হতে পারে।
Node হতে পারে:
- Physical Server
- Virtual Machine
- Cloud Instance
সহজভাবে:
Example:
Node 1 → Application workloads
Node 2 → Backend workloads
Node 3 → Database-related workloads
পুরোনো Kubernetes terminology-তে Node-কে কখনো কখনো:
বলা হতো।
কিন্তু এখন standard term:
2. Cluster কী?
একটা Cluster হলো multiple Nodes-এর group যেগুলো Kubernetes একসাথে manage করে।
Example:
Kubernetes Cluster
│
├── Node 1
├── Node 2
└── Node 3
ধরো তোমার শুধু একটা Node আছে:
Node 1
↓
Application
Node 1 fail করলে:
Node 1 ❌
↓
Application Down ❌
কিন্তু multiple Nodes থাকলে:
Node 1
Node 2
Node 3
Kubernetes workloads অন্য available nodes-এ run করাতে পারে।
এই কারণে cluster-এর benefits:
- Better availability
- More capacity
- Workload distribution
- Failure recovery
- Scalability
সহজ definition:
3. Master Node / Control Plane কী?
আগে Kubernetes-এ অনেক সময় বলা হতো:
Modern terminology-তে সাধারণত বলা হয়:
Control Plane হলো Kubernetes cluster-এর management layer।
সহজ analogy:
এটা decide এবং manage করে:
- কোন workloads কোথায় run করবে
- কোন nodes available
- Cluster-এর desired state কী
- কোনো workload fail করেছে কিনা
- নতুন workload schedule করতে হবে কিনা
- Cluster configuration কী
- Scaling বা recovery দরকার কিনা
Conceptually:
Control Plane
↓
┌───────────┼───────────┐
↓ ↓ ↓
Node 1 Node 2 Node 3
Control Plane মূলত cluster manage করে।
Application workload সাধারণত Worker Nodes-এ run করা হয়।
4. Worker Node vs Control Plane
Difference খুব simple।
| Component | Main Job |
|---|---|
| Control Plane | Cluster manage করা |
| Worker Node | Application workloads run করা |
Company analogy:
Control Plane = Manager
Worker Nodes = Employees
Containers / Pods = Actual Work
Manager নিজে সব কাজ করছে না।
Manager decide করছে:
5. Kubernetes Architecture Overview
Basic architecture:
Kubernetes Cluster
│
┌────────────┴────────────┐
│ │
Control Plane Worker Nodes
│ │
┌────────┼────────┐ ┌──────┼──────┐
│ │ │ │ │ │
API Server etcd Scheduler Kubelet Runtime Pods
│
Controller Manager
আরেকটু clear করে:
Kubernetes Cluster
Control Plane
├── API Server
├── etcd
├── Scheduler
└── Controller Manager
Worker Node 1
├── Kubelet
├── Container Runtime
└── Pods / Containers
Worker Node 2
├── Kubelet
├── Container Runtime
└── Pods / Containers
এখন একটা একটা করে বুঝি।
6. API Server
API Server হলো Kubernetes-এর main entry point।
সহজভাবে:
তুমি Kubernetes-এর সাথে directly বেশিরভাগ সময় কথা বলো না।
তুমি use করো:
kubectl
তারপর:
kubectl
↓
API Server
↓
Kubernetes
Example:
kubectl get nodes
এখানে kubectl request পাঠায়:
Request যায়:
kubectl
↓
API Server
API Server তারপর required information process করে।
API Server-এর সাথে কারা communicate করতে পারে?
শুধু kubectl না।
Example:
kubectl
Dashboard
External Application
Automation Tool
CI/CD Pipeline
Management Platform
↓
API Server
তাই API Server-কে ভাবতে পারো:
7. etcd
etcd হলো একটি:
শুরুতে সহজভাবে এটাকে ভাবতে পারো:
Kubernetes cluster-এর important state এখানে store থাকে।
যেমন:
- Nodes information
- Cluster configuration
- Workload state
- Kubernetes objects
- Metadata
- Desired state
Example:
তুমি Kubernetes-কে বললে:
I want 3 replicas of my application.
Kubernetes-এর cluster state-এর অংশ হিসেবে এই desired configuration persist করা হয়।
etcd কেন Important?
ধরো Kubernetes জানতে চায়:
তখন stored cluster state দরকার।
Conceptually:
Kubernetes
↓
etcd
↓
Cluster State
সহজভাবে মনে রাখো:
8. Scheduler
Scheduler decide করে নতুন workload কোন Node-এ run করবে।
খুব important:
Scheduler শুধু decide করে:
Example:
তোমার আছে:
Node 1
CPU available: 20%
Node 2
CPU available: 70%
Node 3
CPU available: 40%
এখন নতুন workload এসেছে।
Scheduler বিভিন্ন factor দেখে decide করতে পারে:
New Pod
↓
Scheduler
↓
Node 2 selected
Scheduler consideration-এর মধ্যে থাকতে পারে:
- Available CPU
- Available Memory
- Node availability
- Resource requirements
- Scheduling constraints
- Affinity / Anti-affinity
- Taints / Tolerations
শুরুতে শুধু এটা মনে রাখো:
9. Scheduler-এর Simple Example
তুমি বললে:
Run my application.
Kubernetes-এ নতুন Pod create করা দরকার।
Flow:
New Pod Required
↓
Scheduler checks Nodes
↓
Node 1?
Node 2?
Node 3?
↓
Scheduler selects Node 2
তারপর actual workload start করার কাজ Worker Node-এর components handle করবে।
10. Controllers কী?
Controllers continuously cluster observe করে।
তাদের main goal:
এই concept আমরা আগের lecture-এ দেখেছি।
ধরো তুমি বলেছ:
Desired State
=
3 application replicas
বর্তমানে:
App 1 ✅
App 2 ✅
App 3 ✅
Actual:
3
সব ঠিক।
হঠাৎ:
App 2 ❌
এখন:
Desired State = 3
Actual State = 2
Controller detect করবে:
তারপর Kubernetes নতুন instance তৈরি করার process শুরু করবে।
শেষে:
Desired = 3
Actual = 3
আবার match।
11. Controllers-কে Supervisor হিসেবে ভাবো
Company analogy:
Manager says:
"We need 3 workers."
Supervisor checks:
Worker 1 ✅
Worker 2 ✅
Worker 3 ❌
Supervisor:
"We're missing one."
New Worker added
Total = 3 ✅
এটাই controller-এর basic idea।
12. Controller Manager
Kubernetes-এ শুধু একটা ধরনের controller নেই।
বিভিন্ন controllers থাকে।
তাদের অনেকগুলো:
component-এর মাধ্যমে operate করে।
Beginner level-এ মনে রাখো:
Controller Manager
↓
Controllers
↓
Watch Cluster
↓
Detect Difference
↓
Take Corrective Action
13. Container Runtime
এখন Worker Node-এর দিকে যাই।
Container কে actually run করবে কে?
Kubernetes নিজে directly Linux process/container create করার low-level কাজ করে না।
এজন্য দরকার:
Container Runtime-এর কাজ:
Common examples:
- containerd
- CRI-O
Docker-এর সাথে container concepts শেখানো হয় বলে lectures-এ Docker example খুব common।
Concept:
Kubernetes
↓
Kubelet
↓
Container Runtime
↓
Container
সহজ definition:
14. Kubelet
Kubelet Kubernetes architecture-এর খুব important component।
প্রতিটা Worker Node-এ:
run করে।
Example:
Worker Node 1
├── Kubelet
├── Container Runtime
└── Application Pods
Kubelet-কে ভাবতে পারো:
15. Kubelet কী করে?
Kubelet-এর responsibilities-এর মধ্যে আছে:
- Node-এর workloads manage করা
- Control Plane-এর desired workload information follow করা
- Container Runtime-এর মাধ্যমে containers start করানো
- Pod/container status monitor করা
- Node health/status report করা
Simple flow:
Control Plane
↓
Workload should run on Node 1
↓
Kubelet on Node 1
↓
Container Runtime
↓
Container starts
16. API Server এবং Kubelet Relationship
Simplifiedভাবে:
API Server
↓
Kubelet
↓
Container Runtime
↓
Container
অর্থাৎ Kubernetes control plane-এর decision শেষ পর্যন্ত Worker Node-এর Kubelet execute করতে সাহায্য করে।
সহজ analogy:
API Server = Head Office
Kubelet = Local Branch Manager
Container Runtime = Machine doing the work
17. Worker Node-এর Architecture
একটা basic Worker Node:
Worker Node
│
├── Kubelet
│
├── Container Runtime
│
└── Application Workloads
আর Kubernetes terminology-তে application containers সাধারণত:
Pod
↓
Container
structure-এর মধ্যে থাকে।
তাই technically আরও useful diagram:
Worker Node
│
├── Kubelet
├── Container Runtime
│
├── Pod 1
│ └── Container
│
└── Pod 2
└── Container
18. Control Plane-এর Architecture
Basic Control Plane:
Control Plane
│
├── API Server
├── etcd
├── Scheduler
└── Controller Manager
এখন roleগুলো একসাথে:
API Server
= Communication
etcd
= Cluster State
Scheduler
= Where should workload run?
Controller Manager
= Is desired state being maintained?
এই চারটা difference clear থাকলে Kubernetes architecture অনেকটা clear হয়ে যাবে।
19. kubectl কী?
kubectl হলো Kubernetes-এর Command Line Interface বা CLI।
তুমি command line থেকে Kubernetes cluster-এর সাথে interact করতে kubectl use করো।
সহজ definition:
Concept:
You
↓
kubectl
↓
API Server
↓
Kubernetes Cluster
20. kubectl দিয়ে কী করতে পারো?
Example:
- Cluster status check
- Nodes দেখতে
- Pods দেখতে
- Application deploy করতে
- Logs দেখতে
- Resources create/delete করতে
- Configuration apply করতে
- Troubleshooting করতে
Example commands:
kubectl get nodes
kubectl get pods
kubectl cluster-info
21. kubectl get nodes
Command:
kubectl get nodes
মানে:
Example output:
NAME STATUS ROLES
node-1 Ready control-plane
node-2 Ready worker
node-3 Ready worker
এখানে:
NAME
Node-এর নাম।
STATUS
Node ready আছে কিনা।
Example:
Ready
মানে Kubernetes workloads run করার জন্য Node usable।
ROLES
Node কী role পালন করছে।
যেমন:
control-plane
worker
22. kubectl cluster-info
Command:
kubectl cluster-info
এটা cluster-এর important endpoint/information দেখাতে ব্যবহার করা হয়।
Concept:
kubectl cluster-info
↓
Cluster-related information
23. kubectl run
Lecture-এ তুমি দেখতে পারো:
kubectl run
এটা দিয়ে basic workload/Pod create করার command use করা যায়।
Example concept:
kubectl run
↓
API Server
↓
Kubernetes
↓
Pod created
Production application deployment শেখার সময় তুমি পরে আরও important objects দেখবে, বিশেষ করে:
তাই সামনে common হবে:
Deployment
↓
ReplicaSet
↓
Pods
↓
Containers
24. Full Request Flow
এখন architecture-এর সবচেয়ে important part।
ধরো তুমি Kubernetes-কে বললে:
Simplified flow:
You
↓
kubectl
↓
API Server
↓
Kubernetes desired state
↓
Scheduler
↓
Worker Node selected
↓
Kubelet
↓
Container Runtime
↓
Container starts
এটাই main flow।
25. Step-by-Step Example
ধরো তুমি application deploy করলে।
Step 1 — kubectl
তুমি command দিলে:
kubectl
Step 2 — API Server
kubectl request পাঠালো:
kubectl
↓
API Server
API Server request receive এবং process করে।
Step 3 — Cluster State
Desired configuration/state Kubernetes persist করে।
Conceptually:
API Server
↓
Cluster state
↓
etcd
Step 4 — Scheduler
Kubernetes দেখে workload-এর এখনো কোনো Node assigned নেই।
Scheduler check করে:
Node 1
Node 2
Node 3
তারপর choose করল:
Node 2
Step 5 — Kubelet
Node 2-এর Kubelet দেখে:
Node 2
↓
Kubelet
Step 6 — Container Runtime
Kubelet container runtime-কে workload start করতে সাহায্য করে।
Kubelet
↓
Container Runtime
↓
Container
Step 7 — Controllers
Controllers continuously system observe করে।
যদি desired state হয়:
3 replicas
কিন্তু actual হয়:
2 replicas
Kubernetes corrective action নেবে।
26. পুরো Architecture একসাথে
এই diagramটা খুব important:
YOU
│
kubectl
│
▼
┌─────────────────┐
│ API Server │
└────────┬────────┘
│
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
etcd Scheduler Controllers
│ │ │
└──────────────┼──────────────┘
│
CONTROL PLANE
│
▼
─────────────────
│
┌────────────┴────────────┐
▼ ▼
Worker Node 1 Worker Node 2
│ │
Kubelet Kubelet
│ │
Container Runtime Container Runtime
│ │
Pods Pods
│ │
Containers Containers
27. Delivery Company Analogy
এখন পুরো Kubernetes architecture analogy দিয়ে বুঝি।
ধরো Kubernetes হলো একটা Delivery Company।
| Kubernetes | Real-Life Example |
|---|---|
| Cluster | পুরো company |
| Control Plane | Head office / management |
| Worker Node | Delivery branch |
| Pod/Container | Actual task/package |
| API Server | Reception desk |
| etcd | Company database |
| Scheduler | কাজ assign করা dispatcher |
| Controller | Supervisor |
| Kubelet | Branch-এর local manager |
| Container Runtime | Actual execution machinery |
| kubectl | Company-কে instruction দেওয়ার app/phone |
Example
তুমি phone করে বললে:
kubectl
তোমার phone/app।
You
↓
kubectl
API Server
Reception request receive করল।
kubectl
↓
API Server
etcd
Company system-এ request/state record হলো।
Scheduler
Dispatcher decide করল:
Kubelet
Selected branch-এর local manager instruction পেল।
Container Runtime
Actual machinery/process কাজ শুরু করল।
Controller
Supervisor check করতে থাকল:
28. Control Plane vs Worker Node — Final Comparison
| Control Plane | Worker Node |
|---|---|
| Cluster manage করে | Workload run করে |
| API Server | Kubelet |
| Scheduler | Container Runtime |
| etcd | Pods |
| Controllers | Containers |
| Decision making | Execution |
খুব সহজভাবে:
Control Plane
=
DECIDE
Worker Node
=
EXECUTE
29. Components মনে রাখার Easy Trick
Control Plane
মনে রাখো:
A = API Server
E = etcd
S = Scheduler
C = Controllers
অর্থাৎ:
Control Plane
│
├── API
├── etcd
├── Scheduler
└── Controller
Worker Node
মনে রাখো:
K = Kubelet
R = Runtime
P = Pods
Worker
│
├── Kubelet
├── Runtime
└── Pods
30. সবচেয়ে Important Concept
এই পুরো article-এর সবচেয়ে useful mental model:
Control Plane
│
│ decides
▼
Worker Nodes
│
│ execute
▼
Pods
│
▼
Containers
আর user interaction:
User
↓
kubectl
↓
API Server
↓
Kubernetes
31. তোমার Cluster-এর সাথে Relate করলে
তুমি practical Kubernetes cluster দেখলে এমন কিছু দেখতে পারো:
Cluster
│
├── Control Plane Node 1
├── Control Plane Node 2
├── Control Plane Node 3
│
├── Worker Node 1
└── Worker Node 2
Multiple Control Plane nodes থাকার কারণ হতে পারে:
অর্থাৎ একটা Control Plane node fail করলেও পুরো cluster management যেন immediately unavailable না হয়ে যায়।
Worker nodes-এর কাজ:
32. একটা Important Correction
শেখার সময় আমরা অনেক সময় বলি:
আরও technically accurateভাবে:
কারণ Kubernetes-এর fundamental scheduling unit হলো:
তারপর Pod-এর মধ্যে container থাকে।
অর্থাৎ:
Scheduler
↓
Pod
↓
Node
আর Node-এর মধ্যে:
Node
↓
Pod
↓
Container
এই distinction সামনে খুব important হবে।
33. Kubernetes-এর Fundamental Hierarchy
এইটা এখন থেকেই মনে রাখো:
Kubernetes Cluster
│
├── Control Plane
│
└── Worker Nodes
│
└── Pods
│
└── Containers
অর্থাৎ:
এটা Kubernetes শেখার সবচেয়ে important hierarchy-গুলোর একটা।
Final Simplified Explanation
Kubernetes architecture দুইটা major side-এ ভাগ করা যায়:
Control Plane
+
Worker Nodes
Control Plane
Cluster-এর brain।
এখানে important components:
API Server
etcd
Scheduler
Controllers
Worker Node
Application workloads run করে।
এখানে important components:
Kubelet
Container Runtime
Pods / Containers
User Kubernetes-এর সাথে সাধারণত:
kubectl
দিয়ে communicate করে।
Flow:
kubectl
↓
API Server
↓
Scheduler
↓
Worker Node
↓
Kubelet
↓
Container Runtime
↓
Pod
↓
Container
এদিকে:
etcd
cluster-এর state store করে এবং:
Controllers
check করে:
যদি না হয়, Kubernetes system-কে desired state-এ ফিরিয়ে আনার চেষ্টা করে।
One-Line Summary
সবচেয়ে important diagram:
kubectl
│
▼
API Server
│
┌───────────┼───────────┐
▼ ▼ ▼
etcd Scheduler Controllers
│
▼
Worker Node
│
Kubelet
│
Container Runtime
│
Pod
│
Container
আর একদম short memory formula:
