Kubernetes: What Is a Pod?
A Pod is the smallest thing Kubernetes runs. A Pod holds one or more containers that share storage and a network.
One Pod, one container
The common case is simple. One Pod runs one web server container.
kubectl get podsTwo containers that stay together
Two containers share a Pod when they must live and die together. A web server and its log helper are one example.
kubectl get podsA Pod is not a container
A container is one running process. A Pod is the wrapper Kubernetes puts around it.
kubectl describe pod web-podExample
kubectl get pods
kubectl describe pod web-podKey points
- Pod: the smallest unit Kubernetes runs, holding one or more containers.
- Use a Pod to run one container, or a small group of containers that must stay together.
- IP address: the number that names one Pod on the network.
- Port: a number that names one way into an app.
- Volume: storage that a Pod can use.
- Containers in one Pod share an IP address and a port space.
- Containers in one Pod can share a storage volume.
- Kubernetes starts, stops and replaces whole Pods, never single containers.
- A Pod is temporary by design, so its IP address can change when it restarts.
- A Pod runs on one node, and all its containers run on that same node.
In this example, get pods shows one Pod called web-pod. It is ready and running. a closer look then shows the one container inside it. The Pod is the unit Kubernetes manages, and the container is the work inside it.
Note
Most Pods hold one container, and a Pod with two containers is the exception, not the rule.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
What is the smallest thing Kubernetes runs?