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

# IT star is not a dream # illustration of kubernetes container viability mechanism core

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

K8s builds a Manager component to manage the container probe worker, which is responsible for the management of the underlying worker, caches the current state of the container and synchronizes the current state of the container. Today we will analyze some of its core components.

1. Realization of core principle

The state of the Manager cache is mainly consumed by kubelet and state components, and when the Pod synchronizes the state, it updates the Pod container's readiness and startup status through the probe status in the current Manager. Let's take a look at some key implementations of Manager itself.

two。 Probing result management

That is, prober/results/results_manager component, whose main function is to store and notify detection results.

2.1 Core data structure

Cache is responsible for saving the detection results of the container, while updates is responsible for subscribing to update status. By comparing the new results with the status in cache, it decides whether to notify or not.

/ / Manager implementation.type manager struct {/ / protect cache sync.RWMutex / / Container ID- > probe result cache map [kubecontainer.ContainerID] Result / / Update pipeline updates chan Update} 2.2 update cache notification event

When updating the cache, the kubelet core process of whether or not to publish a change event by comparing the status before and after the change is notified to the external subscription container.

Func (m * manager) Set (id kubecontainer.ContainerID, result Result, pod * v1.Pod) {/ / modify internal state if m.setInternal (id, result) {/ / synchronous update event m.updates

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