A Pod is a Kubernetes abstraction that represents a group of one or more application containers (such as Docker), and some shared resources for those containers.
Those resources include:
- Shared storage, as Volumes
- Networking, as a unique cluster IP address
- Information about how to run each container, such as the container image version or specific ports to use
Stuff you wanna know:
- Pods are designed to support multiple cooperating processes (as containers) that form a cohesive unit of service. A Pod is not a process, but an environment for running containers.
- Pods are typically created by controllers. Controllers for workload resources create Pods from a pod template and manage those Pods on your behalf.
- PodTemplates are specifications for creating Pods, and are included in workload resources such as Deployments, Jobs, and DaemonSets.
- Each Pod has an unique IP, persistent storage, and configuration information for containers.
- Agents on a node (e.g. system daemons, kubelet) can communicate with all pods on that node.
- When you create a Deployment on Kubernetes, that Deployment creates Pods with containers inside them (as opposed to creating containers directly).
- Each Pod is tied to the Node where it is scheduled, and remains there until termination (according to restart policy) or deletion.
- The containers in a Pod are automatically co-located and co-scheduled on the same physical or virtual machine in the cluster. These containers can share resources and dependencies, communicate with one another, and coordinate when and how they are terminated.
- Containers within a pod communicate via the localhost.
- Communications outside the pod is done via a port.
- Pods within the same cluster can communicate without NAT.
- A Pod models an application-specific “logical host”. It contains one or more application containers which are relatively tightly coupled.
- As well as application containers, a Pod can contain init containers that run during Pod startup.
- Each Pod is meant to run a single instance of a given application.
- Pods typically contain a single container; there can be pods with multiple containers that work together closely. For example, a Pod might include both the container with your Node.js app as well as a different container that feeds the data to be published by the Node.js webserver.
- If you want to scale your application horizontally (to provide more overall resources by running more instances), you could use multiple Pods, one for each instance.
- Pods are reusable.
- If a pod becomes overloaded, Kubernetes can replicate the pod and deploy it to the cluster.
- Pods are ephemeral. For example, say, a node in a cluster fails, making a pod on that node unresponsive. The controller detects the failure, and creates a replacement pod in a different node.
[Shout out to https://kubernetes.io/]
More stuff:
- Kubernetes concepts — https://kubernetes.io/docs/concepts/workloads/pods/
- Tutorial — https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/
- More Kubernetes concepts —https://kubernetes.io/docs/concepts/workloads/pods/_print/
- Some more Kubernetes concepts —https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/
- Google on Pods — https://cloud.google.com/kubernetes-engine/docs/concepts/pod
- VMware on Pods — https://www.vmware.com/topics/glossary/content/kubernetes-pods
- Red Hat on Pods — https://www.redhat.com/en/topics/containers/what-is-kubernetes-pod