Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the Internal structure of Pod with K8S Source Code

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, Xiaobian will bring you about how to use K8S source code to analyze the internal structure of Pod. The article is rich in content and analyzed and described from a professional perspective. After reading this article, I hope you can gain something.

Pod is the basic unit of K8S scheduling. A Pod contains a Pause container (root container) and multiple user containers. The state of the Pause container represents the state of the Pod, and containers in the same pod share the same ip and data volume.

Therefore, the creation of a Pod starts with building a Sandbox that contains the pause container and initializes a series of resources such as networks/data volumes.

1. Sandbox construction

To create a Pod, you must first build a Sandbox. The process is as follows:

createPodSandbox is the entry method for creation, which consists of two steps:

generatePodSandboxConfig -config for constructing a sandbox, which involves generating a sandbox cgroupParent through Kubelet

RunPodSandBox -Create a sandbox container and launch it via Docker Service(dockershim). There are four main steps: 1. pull image; 2. create container; 3. start container; 4. init network

After the above two steps, the sandbox required by the pod is running, and the network/data volume and other resources are initialized.

2. User Container Creation

Once the SandBox is up and running, you can create a user Container and add it to the Pod. The main process is as follows:

There are three main steps:

EnsureImageExists -Pull Mirrors

CreateContainer -Create container instances with CRI & dockershim

StartContainer -Run Instance

The above is how to use K8S source code to analyze the internal structure of Pod, if there is a similar doubt, you may wish to refer to the above analysis to understand. If you want to know more about it, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report