What are Pods?
In Kubernetes, you don’t run containers directly. Instead, you run them inside a Pod. A Pod is the smallest deployable unit in Kubernetes – a group of one or more containers that share storage, network, and a specification for how to run.
What Is a Pod?
A Pod is like a wrapper around one or more containers. Containers in the same Pod share:
- Network: They share the same IP address and port space, and can communicate via
localhost. - Storage: They can share volumes.
- Lifecycle: They are scheduled together and run on the same node.
A Pod is the atomic unit of scheduling – containers that belong together and need to run on the same machine.
Why Not Just Run Containers?
Containers alone lack the concept of shared resources and lifecycle management. Pods provide:
- Co‑located helpers: e.g., a main app container and a sidecar that logs or proxies.
- Shared volumes for data exchange.
- Simplified networking: containers in the same Pod can talk on localhost.
Pods Are Ephemeral
Pods are not permanent. They are created, die, and are replaced. They are not self‑healing – if a Pod fails, you need a controller (like a Deployment) to recreate it. We’ll cover controllers in the next module.
Pod YAML Example
Here’s a simple Pod definition for an Nginx container:
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80Save as nginx-pod.yaml and create with kubectl apply -f nginx-pod.yaml.Two Minute Drill
- A Pod is the smallest deployable unit in Kubernetes.
- It can contain one or more containers that share network, storage, and lifecycle.
- Containers in the same Pod can communicate via
localhost. - Pods are ephemeral – they are managed by controllers.
- Define a Pod with YAML using
kind: Pod.
Need more clarification?
Drop us an email at career@quipoinfotech.com
