Pod
The smallest deployable unit in Kubernetes.
Represents one or more containers that share:
Storage volumes
Networking (they share the same Pod IP)
Lifecycle
Usually, you run one container per Pod (multi-container Pods are rare and usually for sidecars like logging or monitoring agents).
Why Pods exist?
Containers by themselves don’t have Kubernetes features (no restart policy, scheduling, scaling).
Pods are the Kubernetes wrapper around containers, giving them a lifecycle inside the cluster.
Not recommended to manage Pods directly in production, because if a Pod dies, it won’t come back automatically.
Commands
To apply and run a Pod configuration:
kubectl apply -f pod.yaml
To list all the Pods:
kubectl get pods
To get a description of a Pod:
kubectl describe pod <pod-name>
To delete a Pod:
kubectl delete pod <pod-name>
Check consumption of a Pod:
kubectl top pod <pod-name>
Example
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: nginx:1.25
ports:
- containerPort: 80
env:
- name: NODE_ENV
value: "production"
Last updated