A Kubernetes pod is the smallest unit that Kubernetes creates, schedules and manages. It wraps one or more containers that always run together on the same node, share a network namespace with one IP address and can share storage volumes. Pods are ephemeral: they are not repaired but replaced, which is why they are usually managed by controllers such as Deployments, StatefulSets, DaemonSets or Jobs rather than created directly.
What is a Kubernetes pod?
Kubernetes does not run containers directly. It runs pods, and each pod contains one or more containers. Most pods hold a single application container; some add helpers such as a log shipper, a proxy or an init step. All containers in a pod are scheduled onto the same node, start and stop with the pod and share three things:
- Network: one IP address and port space. Containers in a pod talk to each other via
localhost. - Storage: volumes defined in the pod can be mounted into several containers.
- Lifecycle and identity: one name, one set of labels, one service account and one restart policy.
A minimal pod manifest looks like this:
apiVersion: v1
kind: Pod
metadata:
name: checkout-7d9f8
labels:
app: checkout
spec:
containers:
- name: app
image: registry.example.com/checkout:1.4.2
ports:
- containerPort: 8080
resources:
requests: { cpu: "250m", memory: "256Mi" }
limits: { memory: "512Mi" }
readinessProbe:
httpGet: { path: /ready, port: 8080 }
Pod lifecycle
A pod is created once, assigned to a node by the scheduler and then runs until it terminates or is deleted. It is never moved to another node; if the node fails, a controller creates a new pod elsewhere, with a new name and a new IP address. The status.phase field summarises where a pod is:
| Phase | Meaning |
|---|---|
| Pending | Accepted by the cluster, but not all containers are running yet: waiting for scheduling, image pulls or init containers |
| Running | Bound to a node, at least one container is running or starting |
| Succeeded | All containers terminated successfully and will not be restarted |
| Failed | All containers terminated, at least one with an error |
| Unknown | The state cannot be determined, usually because the node is unreachable |
The phase is coarse. More detail comes from container states (Waiting, Running, Terminated, each with a reason such as ImagePullBackOff, CrashLoopBackOff or OOMKilled) and pod conditions such as PodScheduled, Initialized, ContainersReady and Ready. A pod can be Running but not Ready, which means it receives no traffic from Services because its readiness probe fails.
Init containers and sidecars
Init containers run one after another before the application containers start, for example to wait for a database or run a migration. Sidecar containers run alongside the application for its whole life, for example a service mesh proxy or a log collector. Newer Kubernetes versions support native sidecars, declared as init containers with restartPolicy: Always, which start before and stop after the main containers. The rule of thumb: put containers in one pod only if they must share a node, network or volume and scale together. Otherwise use separate pods.
Pods and their controllers
Pods are rarely created by hand. Controllers create and replace them from a template:
| Controller | Use | Pod identity |
|---|---|---|
| Deployment (via ReplicaSet) | Stateless services, rolling updates | Interchangeable pods with random names |
| StatefulSet | Databases, brokers, anything with stable storage | Stable names and volumes, ordered start |
| DaemonSet | One pod per node, for agents and log collectors | Tied to a node |
| Job and CronJob | Batch work that runs to completion | Pods end in Succeeded or Failed |
Autoscaling works on these controllers too: the Horizontal Pod Autoscaler changes the number of replicas of a Deployment or StatefulSet based on metrics.
Resources and QoS classes
Each container can declare requests and limits for CPU and memory. Requests are used for scheduling, limits cap usage. From these values Kubernetes derives a quality of service class for the pod: Guaranteed when requests equal limits for all containers, Burstable when some requests are set, and BestEffort when none are. Under memory pressure on a node, BestEffort and Burstable pods that exceed their requests are evicted first. A container that exceeds its memory limit is terminated by the kernel, the OOM kill, with exit code 137.
How pods shut down
When a pod is deleted, for example during a rolling update, Kubernetes marks it as terminating and removes it from the endpoints of its Services. It then runs an optional preStop hook and sends SIGTERM to the containers. If they are still running when the grace period ends, 30 seconds by default and configurable with terminationGracePeriodSeconds, they receive SIGKILL. Applications that ignore SIGTERM or exit immediately drop in-flight requests, which shows up as short bursts of errors during every deployment.
Debugging pods
kubectl get pods -n checkout -o wide # phase, restarts, node
kubectl describe pod checkout-7d9f8 -n checkout # events, states, reasons
kubectl logs checkout-7d9f8 -n checkout --previous # logs before last restart
kubectl get events -n checkout --sort-by=.lastTimestamp
kubectl debug -it checkout-7d9f8 -n checkout --image=busybox --target=app
Typical problems and where to look:
- Pending: no node has enough requested CPU or memory, or affinity rules, taints or missing volumes prevent scheduling. The events say which.
- ImagePullBackOff: wrong image name or tag, or missing registry credentials.
- CrashLoopBackOff: the container keeps exiting; the logs of the previous instance usually show why.
- OOMKilled: memory limit too low or a memory leak; compare usage with the limit before the restart.
- Running but not Ready: the readiness probe fails, often because a dependency is unavailable.
- Evicted: the node ran short of memory or disk.
Best practices
- Manage pods through controllers, never as bare pods in production.
- Set requests for every container and memory limits based on measured usage.
- Define readiness and liveness probes that reflect real health, not only that the process exists.
- Handle
SIGTERMand finish in-flight requests within the termination grace period. - Run containers as non-root and give each workload its own service account with minimal RBAC permissions.
- Log to stdout and stderr, so the node's log collection can pick up the output.
The observability perspective
Pods are short-lived and move around, so monitoring a pod by name or IP does not work for long. Useful telemetry is tagged with stable metadata: namespace, workload, container and node, ideally as OpenTelemetry resource attributes such as k8s.namespace.name and k8s.pod.name. Restart counts, phases, OOM kills and warning events are better alert signals than short CPU spikes. Kubernetes keeps events only for a short time, so storing them helps explain later why a pod was evicted or restarted. Keep cardinality in mind as well: every new pod name creates new time series.
How Obseria helps
Kubernetes monitoring in Obseria covers containers and workloads: pods, restarts, resources and health per deployment, so crash loops and OOM kills are found quickly and requests and limits can be set based on real usage. Live Tail shows incoming logs in real time, for example while a new version rolls out, and metrics keep CPU and memory history per workload. Workload threat detection flags suspicious behaviour on hosts from host logs, such as cryptominers or new processes; it detects only and does not block anything.