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

What is the integration method of kubernetes and CNI Plugin

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article focuses on "what is the integration method of kubernetes and CNI Plugin". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what is the integration method of kubernetes and CNI Plugin"?

Libcni

The cni project provides a library written by golang and defines the cni plugin interface that the application integrating the cni plug-in needs to call, which is libcni. The corresponding Interface is defined as follows:

Libcni/api.go:51type CNI interface {AddNetworkList (net * NetworkConfigList, rt * RuntimeConf) (types.Result, error) DelNetworkList (net * NetworkConfigList, rt * RuntimeConf) error AddNetwork (net * NetworkConfig, rt * RuntimeConf) (types.Result, error) DelNetwork (net * NetworkConfig, rt * RuntimeConf) error} when CNI Plugin is called in kubelet-managed PLEG

The syncLoopIteration function is finally called in the kubelet Run method method, which sync the pod through various channel.

Pkg/kubelet/kubelet.go:1794 / / syncLoopIteration reads from various channels and dispatches pods to the// given handler.//// Arguments:// 1. ConfigCh: a channel to read config events from// 2. Handler: the SyncHandler to dispatch pods to// 3. SyncCh: a channel to read periodic sync events from// 4. HouseKeepingCh: a channel to read housekeeping events from// 5. PlegCh: a channel to read PLEG updates from/ / Events are also read from the kubelet liveness manager's update channel.//// The workflow is to read from one of the channels Handle that event, and// update the timestamp in the sync loop monitor.//// Here is an appropriate place to note that despite the syntactical// similarity to the switch statement, the case statements in a select are// evaluated in a pseudorandom order if there are multiple channels ready to// read from when the select is evaluated. In other words, case statements// are evaluated in random order, and you can not assume that the case// statements evaluate in order if multiple channels have events.//// With that in mind, in truly no particular order, the different channels// are handled as follows://// * configCh: dispatch the pods for the config change to the appropriate// handler callback for the event type// * plegCh: update the runtime cache Sync pod// * syncCh: sync all pods waiting for sync// * houseKeepingCh: trigger cleanup of pods// * liveness manager: sync pods that have failed or in which one or more// containers have failed liveness checksfunc (kl * Kubelet) syncLoopIteration (configCh

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