为什么“ ctop命令”在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?

评论
  • awzse
    awzse 回复

    我猜您的pod包含一个容器,这就是为什么您要问这个问题(确实是个好问题!)。

    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

  • 婚礼礼堂
    婚礼礼堂 回复

    没有足够的信息可以给您具体的答案,但我会尝试推测。

    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.

    那就是您可能会看到的。