kubelet热更新configmap

发布时间 2023-11-24 09:23:43作者: 王景迁

k8s v1.19.0

configmap热更新约束

支持热更新:目录方式挂载configmap。
不支持热更新:subPath单个文件方式挂载configmap和configmap注入到环境变量。

configmap热更新逻辑

修改kube-system/configmap coredns后触发kubelet热更新configmap。

pkg/kubelet/volumemanager/reconciler/reconciler.go
mountAttachVolumes方法

reconciler协程会完成unmountVolumes、mountAttachVolumes和unmountDetachDevices。

pkg/kubelet/volumemanager/volume_manager.go
执行周期是100ms。

pkg/kubelet/kubelet.go
NewMainKubelet函数

kubelet syncPod周期是sync-frequency参数决定,默认是1m。

pkg/kubelet/kubelet.go
syncPod方法
等待卷的挂载(包括因configmap更新而重新挂载卷)

卷更新最长时间是1m+100ms。