Exploring what a running pod is

]# docker ps | grep pause
9220b8d70a54        k8s.gcr.io/pause:3.1                                                                                  "/pause"                 17 minutes ago      Up 17 minutes                           k8s_POD_kubia-z92dc_default_cb20846a-706e-11e9-ba83-001e67d8acca_0
2c5420ea4edf        k8s.gcr.io/pause:3.1                                                                                  "/pause"                 17 minutes ago      Up 17 minutes                           k8s_POD_kubia-mf8dj_default_cb1f8b78-706e-11e9-ba83-001e67d8acca_0

This pause container is actually the container that holds all the containers of a pod together.

The pause container is actually 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.

在这里插入图片描述
Figure: A two-container pod results in three running containers sharing the same Linux namespaces

Actual application containers may die and get restarted. When such a container starts up again, it needs to become part of the same namespaces as before. The infrastructure container makes this possible since its lifecycle is tied to that of the pod - the container runs from the time the pod is scheduled until the pod is deleted. If the infrastructure pod is killed in the meantime(在此期间), the Kubelet recreates it and all the pod’s containers.

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐