From d620ffc8a39a497a4dc7317530f5f301584452e5 Mon Sep 17 00:00:00 2001 From: Cooper Tseng Date: Wed, 14 Aug 2024 12:18:07 +0800 Subject: [PATCH] Remove cpu_manager_state in initramfs stage Signed-off-by: Cooper Tseng --- pkg/config/cos.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/config/cos.go b/pkg/config/cos.go index 44e6909b9..d6f2979ca 100644 --- a/pkg/config/cos.go +++ b/pkg/config/cos.go @@ -149,6 +149,11 @@ func ConvertToCOS(config *HarvesterConfig) (*yipSchema.YipConfig, error) { for _, module := range cfg.OS.Modules { initramfs.Commands = append(initramfs.Commands, "modprobe "+module) } + // Delete the cpu_manager_state file during the initramfs stage. During a reboot, this state file is always reverted + // because it was originally created during the system installation, becoming part of the root filesystem. + // As a result, the policy in cpu_manager_state file is "none" after reboot. If we've already set the cpu-manager-policy to + // "static" before reboot, this mismatch can prevent kubelet from starting, and make the entire node unavailable. + initramfs.Commands = append(initramfs.Commands, "rm -f /var/lib/kubelet/cpu_manager_state") initramfs.Sysctl = cfg.OS.Sysctls initramfs.Environment = cfg.OS.Environment