- Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.
- A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage/network resources, and a specification for how to run the containers.
Epheemeral Containers
-
Pods die, they die often, and sometimes without warning.
-
When a pod dies, it is replaced by a new pod (if a controller like a Deployment/ReplicaSet or StatefulSet manages it; a bare pod from
kubectl runjust stays dead). -
The ephemeral (fancy word for “temporary”) nature of Pods is one of the defining features of Kubernetes. Unlike traditional virtual machines (VMs) or physical servers that might run indefinitely (or until hardware failure), Pods are designed to be spun up, torn down, and restarted at a moment’s notice.
-
Why are they temporary?
- Flexibility and resilience. If a Pod encounters a problem, it can be easily terminated and replaced with a new, healthy instance.
- This model not only allows for high availability but also promotes immutability. Instead of manually patching or updating existing environments, you spin up new versions of the entire environment.
-
How does it affect me?
- As a developer, it’s crucial to understand that it’s rarely a good idea to store persistent data on a Pod.
- They can be terminated and replaced, and any locally saved data will be lost. Plan on your image restarting from scratch often!
Unique IP Address
- Every Pod in a Kubernetes cluster has a unique IP address.
- This means that each Pod can communicate with other Pods in the cluster using its IP address.
- This is a key feature of Kubernetes, as it allows for seamless communication between Pods, regardless of where they are running in the cluster.