Yasir
Yasir

Reputation: 9

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

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?

Upvotes: 0

Views: 98

Answers (2)

suren
suren

Reputation: 8786

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.

Upvotes: 2

omricoco
omricoco

Reputation: 931

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

Upvotes: 3

Related Questions