Merge pull request #134298 from kannon92/kep-5573-cgroupv1-unsupported

[KEP-5573] Set failCgroupV1 to true
This commit is contained in:
Kubernetes Prow Robot 2025-10-14 11:37:34 -07:00 committed by GitHub
commit d92afdefcb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 19 additions and 19 deletions

View file

@ -71931,7 +71931,7 @@ func schema_k8sio_kubelet_config_v1beta1_KubeletConfiguration(ref common.Referen
},
"failCgroupV1": {
SchemaProps: spec.SchemaProps{
Description: "FailCgroupV1 prevents the kubelet from starting on hosts that use cgroup v1. By default, this is set to 'false', meaning the kubelet is allowed to start on cgroup v1 hosts unless this option is explicitly enabled. Default: false",
Description: "FailCgroupV1 prevents the kubelet from starting on hosts that use cgroup v1. By default, this is set to 'true', meaning the kubelet will not start on cgroup v1 hosts unless this option is explicitly disabled. Default: true",
Type: []string{"boolean"},
Format: "",
},

View file

@ -38,7 +38,7 @@ enforceNodeAllocatable:
eventBurst: 100
eventRecordQPS: 50
evictionPressureTransitionPeriod: 5m0s
failCgroupV1: false
failCgroupV1: true
failSwapOn: true
fileCheckFrequency: 20s
hairpinMode: promiscuous-bridge

View file

@ -38,7 +38,7 @@ enforceNodeAllocatable:
eventBurst: 10
eventRecordQPS: 5
evictionPressureTransitionPeriod: 5m0s
failCgroupV1: false
failCgroupV1: true
failSwapOn: true
fileCheckFrequency: 20s
hairpinMode: promiscuous-bridge

View file

@ -290,7 +290,7 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
obj.SeccompDefault = ptr.To(false)
}
if obj.FailCgroupV1 == nil {
obj.FailCgroupV1 = ptr.To(false)
obj.FailCgroupV1 = ptr.To(true)
}
if obj.MemoryThrottlingFactor == nil {
obj.MemoryThrottlingFactor = ptr.To(DefaultMemoryThrottlingFactor)

View file

@ -126,7 +126,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) {
EnableProfilingHandler: ptr.To(true),
EnableDebugFlagsHandler: ptr.To(true),
SeccompDefault: ptr.To(false),
FailCgroupV1: ptr.To(false),
FailCgroupV1: ptr.To(true),
MemoryThrottlingFactor: ptr.To(DefaultMemoryThrottlingFactor),
RegisterNode: ptr.To(true),
LocalStorageCapacityIsolation: ptr.To(true),
@ -261,7 +261,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) {
EnableProfilingHandler: ptr.To(false),
EnableDebugFlagsHandler: ptr.To(false),
SeccompDefault: ptr.To(false),
FailCgroupV1: ptr.To(false),
FailCgroupV1: ptr.To(true),
MemoryThrottlingFactor: ptr.To[float64](0),
RegisterNode: ptr.To(false),
LocalStorageCapacityIsolation: ptr.To(false),
@ -366,7 +366,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) {
EnableProfilingHandler: ptr.To(false),
EnableDebugFlagsHandler: ptr.To(false),
SeccompDefault: ptr.To(false),
FailCgroupV1: ptr.To(false),
FailCgroupV1: ptr.To(true),
MemoryThrottlingFactor: ptr.To[float64](0),
RegisterNode: ptr.To(false),
LocalStorageCapacityIsolation: ptr.To(false),
@ -779,7 +779,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) {
EnableProfilingHandler: ptr.To(true),
EnableDebugFlagsHandler: ptr.To(true),
SeccompDefault: ptr.To(false),
FailCgroupV1: ptr.To(false),
FailCgroupV1: ptr.To(true),
MemoryThrottlingFactor: ptr.To(DefaultMemoryThrottlingFactor),
RegisterNode: ptr.To(true),
LocalStorageCapacityIsolation: ptr.To(true),
@ -875,7 +875,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) {
EnableProfilingHandler: ptr.To(true),
EnableDebugFlagsHandler: ptr.To(true),
SeccompDefault: ptr.To(false),
FailCgroupV1: ptr.To(false),
FailCgroupV1: ptr.To(true),
MemoryThrottlingFactor: ptr.To(DefaultMemoryThrottlingFactor),
RegisterNode: ptr.To(true),
LocalStorageCapacityIsolation: ptr.To(true),
@ -971,7 +971,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) {
EnableProfilingHandler: ptr.To(true),
EnableDebugFlagsHandler: ptr.To(true),
SeccompDefault: ptr.To(false),
FailCgroupV1: ptr.To(false),
FailCgroupV1: ptr.To(true),
MemoryThrottlingFactor: ptr.To(DefaultMemoryThrottlingFactor),
RegisterNode: ptr.To(true),
LocalStorageCapacityIsolation: ptr.To(true),
@ -1067,7 +1067,7 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) {
EnableProfilingHandler: ptr.To(true),
EnableDebugFlagsHandler: ptr.To(true),
SeccompDefault: ptr.To(false),
FailCgroupV1: ptr.To(false),
FailCgroupV1: ptr.To(true),
MemoryThrottlingFactor: ptr.To(DefaultMemoryThrottlingFactor),
RegisterNode: ptr.To(true),
LocalStorageCapacityIsolation: ptr.To(true),

View file

@ -34,7 +34,7 @@ const userNsUnitLength = 65536
func validateKubeletOSConfiguration(kc *kubeletconfig.KubeletConfiguration) error {
isCgroup1 := !libcontainercgroups.IsCgroup2UnifiedMode()
if kc.FailCgroupV1 && isCgroup1 {
return fmt.Errorf("kubelet is configured to not run on a host using cgroup v1. cgroup v1 support is in maintenance mode")
return fmt.Errorf("kubelet is configured to not run on a host using cgroup v1. cgroup v1 support is unsupported and will be removed in a future release")
}
if isCgroup1 && kc.SingleProcessOOMKill != nil && !ptr.Deref(kc.SingleProcessOOMKill, true) {

View file

@ -49,7 +49,7 @@ import (
const (
// Warning message for the users still using cgroup v1
CgroupV1MaintenanceModeWarning = "cgroup v1 support is in maintenance mode, please migrate to cgroup v2"
CgroupV1DeprecatedWarning = "cgroup v1 detected. cgroup v1 support is deprecated and will be removed in a future release. Please migrate to cgroup v2. More information at https://git.k8s.io/enhancements/keps/sig-node/5573-remove-cgroup-v1"
// Warning message for the users using cgroup v2 on kernel doesn't support root `cpu.stat`.
// `cpu.stat` was added to root cgroup in kernel 5.8.

View file

@ -36,8 +36,8 @@ func (kl *Kubelet) cgroupVersionCheck() error {
metrics.CgroupVersion.Set(float64(cgroupVersion))
switch cgroupVersion {
case 1:
kl.recorder.Eventf(kl.nodeRef, v1.EventTypeWarning, events.CgroupV1, cm.CgroupV1MaintenanceModeWarning)
return errors.New(cm.CgroupV1MaintenanceModeWarning)
kl.recorder.Eventf(kl.nodeRef, v1.EventTypeWarning, events.CgroupV1, cm.CgroupV1DeprecatedWarning)
return errors.New(cm.CgroupV1DeprecatedWarning)
case 2:
cpustat := filepath.Join(util.CgroupRoot, "cpu.stat")
if _, err := os.Stat(cpustat); os.IsNotExist(err) {

View file

@ -915,10 +915,10 @@ type KubeletConfiguration struct {
ImageServiceEndpoint string `json:"imageServiceEndpoint,omitempty"`
// FailCgroupV1 prevents the kubelet from starting on hosts
// that use cgroup v1. By default, this is set to 'false', meaning
// the kubelet is allowed to start on cgroup v1 hosts unless this
// option is explicitly enabled.
// Default: false
// that use cgroup v1. By default, this is set to 'true', meaning
// the kubelet will not start on cgroup v1 hosts unless this
// option is explicitly disabled.
// Default: true
// +optional
FailCgroupV1 *bool `json:"failCgroupV1,omitempty"`