📋 Understanding Pods
🎯 Why Pods Matter
The Atomic Unit: Pods are the smallest deployable units in Kubernetes - not containers!
Key Insight: A Pod can contain multiple containers that share storage and network.
Real Impact: Understanding Pods is crucial for designing scalable applications.
🏠
Real-World Analogy
Think of a Pod as an apartment:
- 🏠 Pod = The apartment unit
- 🚪 Containers = Roommates sharing the apartment
- 🌐 Network = Shared WiFi (localhost communication)
- 💾 Volumes = Shared storage closets
- 🏢 Node = The apartment building
Pod Architecture
Pod
📦 Main Container
nginx:latest
nginx:latest
📦 Sidecar Container
logging-agent
logging-agent
Shared: Network (localhost) | Storage (volumes) | IPC
Basic Pod YAML Structure
simple-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: my-first-pod
labels:
app: web
environment: development
spec:
containers:
- name: web-container
image: nginx:1.21
ports:
- containerPort: 80
name: http
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
💡 Key Concepts
- One IP per Pod: All containers in a Pod share the same network namespace
- Ephemeral by Design: Pods are meant to be disposable and recreatable
- Co-location: Containers in a Pod are always scheduled on the same node
- Shared Lifecycle: All containers start and stop together