Skip to content

Commit 4018b67

Browse files
committed
docs(notes): add mental model kubernetes responsibility hierarchy
1 parent a88cabc commit 4018b67

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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.

0 commit comments

Comments
 (0)