why 'ctop command' shows two containers for a single deployment in k8s?

5/11/2020

I have a deployment in k8s environment and ran ctop command to see memory and cpu utilization.

NAME CID CPU MEM NET RX/TX IO R/W PIDS ◉ k8s_POD_pod1-… c029e2492e7b 0% 1M / 23.54G 0B / 0B 0B / 0B 1 ◉ k8s_pod1_… 411fc43165fe 6% 23M / 23.54G 0B / 0B 0B / 0B 115 why there are k8s_POD_* and k8s_*, two containers for single entity?

-- Yasir
kubernetes

2 Answers

5/11/2020

I guess your pod contains a single container, that is why you are asking this question (which is indeed a good question!).

So, one of these containers is the one you actually deployed, but the second one is a Kubernetes infrastructure container, known as a pause container.

This pause container is the container that holds all the containers of a pod together. All containers of a pod share the same network and other Linux namespaces. The pause container is an infrastructure container whose sole purpose is to hold all these namespaces. All other user-defined containers of the pod then use the namespaces of the pod infrastructure container.

See more details here: https://www.ianlewis.org/en/almighty-pause-container

-- omricoco
Source: StackOverflow

5/11/2020

There is no enough information to give you a concrete answer, but Ill try to speculate.

As Kubernetes works, it needs a base container pause, to create the network namespace, to get the network interface and an IP address. Then it adds the additional containers to this network namespace.

That's what you might be seeing.

-- suren
Source: StackOverflow