protectKernelDefaults如何起作用

本文探讨了kubelet配置中的protectKernelDefaults参数如何影响系统行为,特别是涉及containerManagerImpl私有方法setupNode的过程。同时,解释了CGroup和CFS在Linux内核中的角色,CGroup用于限制和隔离进程资源,而CFS负责实现CPU的公平调度。
摘要由CSDN通过智能技术生成

protectKernelDefaults如何起作用

1. kubelet配置中的一个参数

//该结构体位于:kubernetes/staging/src/k8s.io/kubelet/config/v1beta1/types.go
type KubeletConfiguration struct {
   
	metav1.TypeMeta `json:",inline"`
	// protectKernelDefaults, if true, causes the Kubelet to error if kernel
	// flags are not as it expects. Otherwise the Kubelet will attempt to modify
	// kernel flags to match its expectation.
	// Dynamic Kubelet Config (beta): If dynamically updating this field, consider that
	// enabling it may cause the Kubelet to crash-loop if the Kernel is not configured as
	// Kubelet expects.
	// Default: false
	// +optional
	ProtectKernelDefaults bool `json:"protectKernelDefaults,omitempty"`
	}

2. containerManagerImpl

//该结构体位于:kubernetes/pkg/kubelet/cm/container_manager_linux.go

type containerManagerImpl struct {
   
	sync.RWMutex
	cadvisorInterface cadvisor.Interface
	mountUtil         mount.Interface
	NodeConfig    //包含ProtectKernelDefaults配置
	status Status
	// External containers being managed.
	systemContainers []*systemContainer
	// Tasks that are run periodically
	periodicTasks []func()
	// Holds all the mounted cgroup subsystems
	subsystems *CgroupSubsystems
	nodeInfo   *v1.Node
	// Interface for cgroup management
	cgroupManager CgroupManager
	// Capacity of this node.
	capacity v1.ResourceList
	// Capacity of this node, including internal resources.
	internalCapacity v1.ResourceList
	// Absolute cgroupfs path to a cgroup that Kubelet needs to place all pods under.
	// This path include a top level container for enforcing Node Allocatable.
	cgroupRoot CgroupName
	// Event recorder interface.
	recorder record.EventRecorder
	// Interface for QoS cgroup management  k8s根据Requests和Limits划分Pod Qos
	qosContainerManager QOSContainerManager
	// Interface for exporting and allocating devices reported by device plugins.
	deviceManager devicemanager.Manager
	// Interface for CPU affinity management.
	cpuManager cpumanager.Manager
	// Interface for Topology resource co-ordination
	topologyManager topologymanager.Manager
}

//该结构体位于 kubernetes/pkg/kubelet/cm/container_manager.go
type NodeConfig struct {
   
	RuntimeCgroupsName 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王伯爵

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值