File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Kubernetes Responsibility Hierarchy
2+
3+ Think of Kubernetes as a chain of responsibility. Every layer has exactly one job.
4+
5+ ```
6+ You
7+ │
8+ ▼
9+ Deployment
10+ "I want 3 Pods."
11+ │
12+ ▼
13+ ReplicaSet
14+ "I will always keep 3 Pods running."
15+ │
16+ ▼
17+ Pods
18+ "I contain one or more containers."
19+ │
20+ ▼
21+ Container Runtime (containerd)
22+ "I start and stop containers."
23+ │
24+ ▼
25+ Containers
26+ "The actual application."
27+ ```
28+
29+ ## Responsibilities
30+
31+ - ** Deployment** → Declares the desired state and manages updates.
32+ - ** ReplicaSet** → Ensures the desired number of Pods are running.
33+ - ** Pod** → Groups one or more containers that should run together.
34+ - ** Container Runtime** → Starts and stops containers on the node.
35+ - ** Container** → Runs the application code.
36+
37+ ## Self-Healing
38+
39+ If a Pod dies:
40+
41+ ```
42+ Desired Pods = 3
43+ Current Pods = 2
44+
45+ ↓
46+
47+ ReplicaSet creates a new Pod
48+
49+ ↓
50+
51+ The Pod requests its containers
52+
53+ ↓
54+
55+ The container runtime starts them
56+
57+ ↓
58+
59+ Current Pods = 3
60+ ```
61+
62+ The ReplicaSet restores the desired state automatically.
63+
64+ ## Scaling
65+
66+ When you scale a Deployment:
67+
68+ ```
69+ Replicas: 3
70+
71+ ↓
72+
73+ Replicas: 10
74+ ```
75+
76+ The ReplicaSet creates 7 additional Pods, and each Pod starts its required containers through the container runtime.
77+
78+ Kubernetes doesn't directly create containers—it creates Pods. The container runtime is responsible for launching the containers inside those Pods.
You can’t perform that action at this time.
0 commit comments