What is the Purpose of the Pause Container in Kubernetes?

adil
2 min readSep 11, 2023

--

Part 2: How do Containers Communicate via localhost in a Kubernetes Pod?

When you try to deploy a container or multiple containers in a Pod, Kubernetes creates a Pause container in the Pod.

***** You can follow me on LinkedIn *****

Photo by Vladislav Bychkov on Unsplash

The containers you deploy will be attached to the Pause container’s ipc , uts , network namespaces.

Until this change, the containers were attached to the pid namespace of the Pause container as well.

Here’s the source code of the Pause container: https://github.com/kubernetes/kubernetes/blob/v1.28.1/build/pause/linux/pause.c

As you can see in the source code, the main purpose of the Pause container was to replicate the init process (pid 1) in Kubernetes.

The main purpose of the Pause container was to prevent the zombie process in the pod. The Pause container no longer performs this functionality after this change.

Why is a Pause container still present in every Pod?

Because containers in the same Pod must communicate with each other faster.

Thanks to the Pause container’s network namespace, containers in the same Pod can communicate with each other via localhost.

I have an article that explains the use of the Pause container’s network namespace in the Kubernetes pod:

How do Containers Communicate via localhost in a Kubernetes Pod?

Thanks to the Pause container’s uts namespace, containers in the same Pod can have the same hostname (pod’s name).

Thanks to the Pause container’s ipc namespace, containers in the same Pod can see each other’s IPC resources (message queues, shared memory segments, semaphores).

--

--