Kubernetes Pod Definition
A Kubernetes Pod is a group of containers that share storage, networking, and lifecycle, forming the basic unit of deployment in Kubernetes.
Kubernetes Pod Definition is the precise characterization of a Pod as the smallest unit of deployment recognized by the Kubernetes scheduler: a group of one or more containers that share a network namespace, a set of storage volumes, and a single lifecycle, formally scheduled, started, and terminated together as one indivisible entity, even though the containers within it remain individually distinguishable processes.
Formal Boundaries of a Pod
Atomic Scheduling Unit
By definition, the scheduler assigns an entire Pod to exactly one node; it never splits a Pod's containers across multiple nodes. This atomicity is not a convenience but a formal constraint of the object model: spec.nodeName, once set, applies to the whole Pod, and every container within it runs on that same node for the Pod's entire lifetime.
Shared Execution Context
A Pod formally defines a shared execution context for its containers: a single network namespace, meaning all containers share one IP address and can reach each other over localhost; a single IPC namespace, by default; and a set of Pod-level volumes that individual containers may mount, none of which any single container could establish on its own without the Pod construct.
apiVersion: v1
kind: Pod
metadata:
name: codartium-analyzer
spec:
containers:
- name: analyzer
image: codartium/analyzer:3.2.0
- name: log-shipper
image: codartium/log-shipper:1.0.0
Containers Within a Pod
Application Containers
The spec.containers list defines the Pod's primary containers, each specifying an image, command, resource requirements, and probes independently, while still sharing the Pod-level network and storage context.
Init Containers
The spec.initContainers list defines containers that formally run to completion, strictly in the listed order, before any container in spec.containers begins; a Pod is not considered to have started its main containers until every init container has exited successfully.
Pod Identity and Volatility
Not Durable by Design
A Pod is formally defined as disposable: it is never migrated between nodes, and it is never restarted with a new specification in place; if its node fails or it is deleted, a new Pod, with a new name, a new UID, and typically a new IP address, must be created to replace it. This is a defining, not incidental, property of the Pod abstraction.
Restart vs. Replacement
Formally, "restarting a Pod" refers to the kubelet restarting one of its containers according to restartPolicy, which does not create a new Pod object; a genuinely new Pod object is created only by the controller managing it, in response to the old Pod's termination.
Pod Specification Fields
spec
A Pod's spec formally includes, among other fields, its list of containers and init containers, the volumes available to them, restartPolicy, terminationGracePeriodSeconds, node placement constraints, and its securityContext, together fully determining how the kubelet should run it.
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 30
volumes:
- name: cache
emptyDir: {}
containers:
- name: analyzer
image: codartium/analyzer:3.2.0
volumeMounts:
- name: cache
mountPath: /var/cache
status
A Pod's status formally reports its phase, its conditions (such as Ready and PodScheduled), its assigned podIP and hostIP, and the per-container status of each container it defines, together representing the kubelet's observed view of the Pod's actual running state.
kubectl get pod codartium-analyzer -o jsonpath='{.status.phase}'
kubectl get pod codartium-analyzer -o jsonpath='{.status.podIP}'
Pods and Higher-Level Controllers
Pods Are Rarely Created Directly
While a Pod can be created as a standalone object, in practice the overwhelming majority of Pods in a cluster exist as the output of a higher-level controller, Deployment, StatefulSet, DaemonSet, or Job, which manages a template from which it creates Pods and owns their ongoing lifecycle.
metadata:
ownerReferences:
- apiVersion: apps/v1
kind: ReplicaSet
controller: true
kubectl get pods -n codartium-team -o wide
kubectl get pod codartium-analyzer -o jsonpath='{.metadata.ownerReferences}'
Why the Pod Boundary Is Fixed at This Level
The Pod is defined at the granularity it is, a group of co-located, co-scheduled containers, rather than at the level of a single container, because the platform's designers identified co-located, tightly-coupled container groups as a common, first-class pattern worth a dedicated abstraction, while still leaving container-level configuration, image, command, resources, fully independent within that shared context.