> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# What is the Pause Container

> Explains Kubernetes pause container, a tiny long‑running process that preserves a Pod's network namespace and IP while application containers restart, plus lifecycle and inspection tips.

Every Kubernetes Pod contains a small, often invisible helper process called the pause container. It usually does not appear in the output of `kubectl get pods`, because that command lists Pods (not each container inside them). The pause container is typically the first container the kubelet or container runtime starts for a Pod and the last one to stop. Its sole job is to hold the Pod’s network namespace stable for the lifetime of the Pod.

## Why Kubernetes needs a pause container

To understand the pause container, first recall what a Pod is:

A Pod is a tightly coupled group of containers that share certain namespaces and resources:

| Shared resource | What it means |
| - | - |
| IP address | All containers in the Pod share a single Pod IP for inbound/outbound network traffic. |
| Network ports | Containers can use the same port numbers and communicate with each other via ports on `localhost`. |
| Localhost communication | Containers share the loopback interface so `localhost` connects to containers within the same Pod. |

On Linux, these networking and namespace shares are implemented using a network namespace. The kernel retains a network namespace only while it is owned by a running process; otherwise it is garbage-collected. Because application containers can crash, restart, or be recreated, Kubernetes needs a stable process that outlives transient container restarts to hold that namespace open. That stable process is the pause container.

## How the pause container is used (lifecycle)

1. The kubelet asks the container runtime to create a new Pod.
2. The runtime creates a network namespace for the Pod.
3. The CNI/network plugin configures that namespace and assigns an IP address.
4. The runtime starts the pause container inside the newly created network namespace.
5. Application containers are started and join the same namespace as the pause container.

Because the pause container is a simple, long-running process that normally never exits, it becomes the stable owner of the network namespace. Typical pause images are tiny (often under 1 MB) and only run a minimal wait-loop.

Minimal pause process example

```c theme={null}
// pause.c
for (;;) {
    pause();
}
```

## Practical implications

* Stable Pod IP: If an application container crashes and is restarted, the pause container keeps running and retains the network namespace and Pod IP. The restarted container rejoins the same namespace and the Pod keeps the same IP.
* Pod teardown on pause termination: If the pause container itself is killed or removed, the kubelet must tear down the Pod. That involves stopping other containers, creating a fresh pause container, asking the CNI plugin for a (possibly different) IP, and starting the application containers again. This can change the Pod IP and disrupt in-Pod networking temporarily.

Quick tips and commands

* To inspect containers at the runtime level you can use runtime-specific tools (for CRI-O/containerd: `crictl ps -a`; for Docker: `docker ps --filter "ancestor=k8s.gcr.io/pause"`), which will often list the pause container for a Pod.
* Pause image examples: `k8s.gcr.io/pause` is a common pause image used in many Kubernetes distributions.

The pause container is not shown by `kubectl get pods` because that command lists Pods (not individual containers). If you inspect container runtimes directly (for example with runtime-specific tools), you will often see the pause container listed for the Pod.

References

* [Kubernetes: Pods](https://kubernetes.io/docs/concepts/workloads/pods/)
* [Container Network Interface (CNI)](https://www.cni.dev/)
* [k8s.gcr.io/pause image (common registry)](https://kubernetes.io/docs/reference/using-api/cluster-management/#pause-container)

> [card] [Watch Video](https://learn.kodekloud.com/user/courses/devops-interview-prep/module/60905e58-3a8e-4423-9743-081b4959f0a0/lesson/9b224087-cb1c-450d-afe7-4f5e7ee5fba3)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.