I’m diving deep into pods today! First, let’s make sure our terminology is straight. Here is the hierarchy of “objects” in Kubernetes:
- Cluster
- Nodes
- Pod
- Container
- Image
- Container
- Pod
- Nodes
In reverse, I would say: “I will create an image of my application and use it to create a container. The container will run in my pod, which will run/scale across my nodes in my cluster.”
Here are some key things to remember about pods in Kubernetes:
- A pod represents a collection of containers and volumes
- Pods are the smallest deployable artifact…and the thing that you scale out
- Resource throttling is at the container level – meaning in certain conditions, you could have multiple containers in a pod, each with dedicated resources
- Containers in the pod share IP address and port space (each would have to be on separate ports but they would share the IP address)
- Containers in the same pod also share the same hostname and interprocess communication channel
- “Containers running in different pods on the same node might as well be on different servers”
- In general, you will put one container per pod (so you can deploy, scale and manage them independently) unless the containers will not run correctly if they land on different nodes. For example, if they need to access the same persistent volume, then they should be in the same pod.