Pod

On this page 7

A pod is the smallest deployable unit in Kubernetes: a group of one or more containers that are always scheduled together on the same node and share a network namespace, an IP address and storage volumes. Kubernetes never runs a bare container; it runs pods, and every higher-level object such as a Deployment or a Job ultimately creates pods.

Pods are ephemeral by design. A pod is created, runs, and eventually terminates; if it is deleted or its node fails, Kubernetes does not repair it but lets a controller such as a ReplicaSet create a replacement pod with a new name and a new IP address. Stable access to a changing set of pods is provided by a Service.

What containers in a pod share

Containers in one pod behave like processes on a single logical host. They reach each other over localhost, share the same port space and can mount the same volumes, while each keeps its own filesystem image and resource limits.

PropertyShared across the podNotes
IP address and portsYesTwo containers cannot listen on the same port
VolumesYes, when mounted by each containeremptyDir is a common shared scratch space
Node placementYesAll containers land on one node
Container image and filesystemNoEach container has its own root filesystem
CPU and memory limitsNo, set per containerThe pod total is the sum for scheduling
Process namespaceOptionalEnabled with shareProcessNamespace
Shared and separate properties of containers in a pod

This sharing is implemented by a hidden pause container that holds the network namespace, so the application containers can restart without the pod losing its IP address.

Pod lifecycle and phases

Every pod moves through a defined set of phases, reported in its status field. Within a running pod, the kubelet on the node restarts failed containers according to the restart policy, which is Always, OnFailure or Never.

PhaseMeaningCommon causes of staying here
PendingAccepted but not all containers are runningNo node with enough resources, image still pulling
RunningBound to a node, at least one container runningNormal operating state
SucceededAll containers exited with code 0Completed Jobs
FailedAll containers ended, at least one with an errorApplication error under restart policy Never
UnknownState cannot be obtainedLost contact with the node
Pod phases and their meaning

A frequently seen status, CrashLoopBackOff, is not a phase but a container state: the container keeps failing and the kubelet waits an increasing back-off delay, capped at five minutes, between restarts.

Pod design patterns

Most pods run a single application container. Additional containers are justified only when they must share the network or files with the main container and scale together with it.

PatternWhat the extra container doesExample
Init containerRuns to completion before the app startsDatabase schema migration or config download
SidecarRuns alongside the app for its whole lifeLog shipper or service mesh proxy
AmbassadorProxies outbound connectionsLocal proxy to a sharded database
AdapterTransforms the app outputConverting metrics to a standard format
Common multi-container pod patterns

Since Kubernetes 1.29, sidecars can be declared as init containers with restartPolicy Always, which guarantees they start before and stop after the main container.

Pods compared with higher-level objects

Pods are rarely created directly in production. Controllers manage them, adding replication, rolling updates and self-healing.

ObjectRelation to podsTypical use
PodThe running unit itselfDebugging, one-off tests
ReplicaSetKeeps a set number of identical pods runningManaged by Deployments
DeploymentManages ReplicaSets for rolling updatesStateless services
StatefulSetPods with stable names and storageDatabases and clustered stores
DaemonSetOne pod on each selected nodeNode agents and log collectors
ServiceStable address routing to matching podsLoad balancing across replicas
How Kubernetes objects relate to pods

Controllers find their pods through labels and selectors, not through names. A Service, for example, routes to every ready pod whose labels match its selector, which is why a careless label change can silently remove pods from load balancing or attach unrelated pods to it. Pod definitions are therefore usually written as a template inside a Deployment and packaged with tools such as Helm, so that every replica is created from the same specification.

Resource settings, probes and common mistakes

The scheduler places a pod based on its resource requests, while limits cap actual use. A container that exceeds its memory limit is OOM-killed; one that exceeds its CPU limit is throttled. Requests and limits together also set the pod’s quality-of-service class: Guaranteed, Burstable or BestEffort.

  • Missing requests let the scheduler overpack nodes, and BestEffort pods are evicted first under pressure.
  • No readiness probe sends traffic to pods that are still starting.
  • An aggressive liveness probe restarts healthy but slow pods in an endless loop.
  • Storing data in the container filesystem loses it whenever the pod is replaced; persistent volumes are required.
  • Relying on pod IP addresses breaks after rescheduling, because replacements get new addresses.

In plain words

Think of a pod as a small shared apartment for programs. The programs living there share one street address, one front door and a common storage room, and they always move house together.

Usually only one program lives in each apartment. Sometimes a helper moves in, such as one that collects the main program’s notes. If the apartment is damaged, Kubernetes does not repair it; it builds an identical new one and moves the work there.

A real-world example

An online learning platform runs its web API on Kubernetes through a Deployment with six replicas. Each pod contains the API container, with a request of 250 millicores of CPU and 512 MiB of memory, and a log-shipping sidecar that reads log files from a shared emptyDir volume and forwards them to central storage.

A readiness probe on the API’s health endpoint ensures that new pods receive traffic only after their caches are warm. When a node fails at night, its two pods are lost, the ReplicaSet creates two replacements on healthy nodes within about a minute, and the Service routes requests only to ready pods. Students see no interruption, and the team investigates the failed node the next morning.