intermediate
Pod
Understand the smallest schedulable unit: one or more containers sharing network identity, volumes, and lifecycle.
A Pod is the smallest schedulable Kubernetes unit. It can run one main container plus sidecars sharing network identity, volumes, and lifecycle — but application scaling usually means more pods, not bigger pods.
apiVersion: v1
kind: Pod
metadata:
name: api
labels:
app: api
spec:
containers:
- name: node
image: my-api:1.2.0
ports:
- containerPort: 3000
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: 512Mi
Containers in a pod share `localhost` and can mount the same volumes. Init containers run to completion before app containers start.
On interviews: shared localhost, restart policy, requests/limits, sidecars, init containers, and why pods are ephemeral.
Common pitfalls: treating pod IPs as stable; packing unrelated processes into one pod; missing resource requests so scheduling and HPA break.
The trade-off is colocation convenience versus independent scaling and failure isolation.
Checklist:
- Treat pods as ephemeral.
- Set requests and limits.
- Use sidecars only for shared lifecycle.
- Prefer Deployments over bare Pods for apps.