Adding CGroup V2 Node
Kubernetes leverages cgroups to enforce container resource isolation. The cgroup v2 system standardizes the resource access path, supports pod-level resource monitoring and network redirection, and strengthens cross-resource coordination through enhanced isolation capabilities. This guide explains how to add cgroup v2 nodes via the CCE console.
Background
Kubernetes relies on cgroups for container resource isolation, categorized into cgroup v1 and v2. The cgroup v2 system provides a more streamlined experience with expanded functionalities. Key features include:
- Standardized resource access path: All resource types are consolidated under a unified structure.
- Enhanced features: Introduces tools like Pressure Stall Information (PSI).
- eBPF support at the cgroup level: Enables pod-specific resource monitoring and network redirect functionalities.
-
Improved resource isolation: Strengthens isolation across multiple resource types.
- Unified memory management: Streamlines management of various memory allocations, such as network and kernel memory.
- Asynchronous resource change metrics: Allows asynchronous I/O limits using metrics like Page Cache Write-back.
Kubernetes introduced alpha support for cgroup v2 in V1.18. It added beta support for cgroup v2 in V1.22. GA support for cgroup v2 was officially released in V1.25. For detailed information, see About cgroup v2
Usage restrictions
-
Currently, only Ubuntu 22.04 and BaiduLinux 3.0 are supported. The usage methods are as follows:
- Ubuntu 22.04 uses cgroup v2 by default; you can select it directly in the console;
- BaiduLinux 3.0 defaults to using cgroup v1. To utilize cgroup v2, build a customized image based on the BaiduLinux 3.0 base image with cgroup v2 compatibility.
- The Kubernetes version must be 1.24 or later.
Operation steps
Manually add a cgroup v2 node
- Sign in to the Baidu AI Cloud management console. Navigate to Product Services - Cloud Native - Cloud Container Engine (CCE). Click Cluster Management - Cluster List, then select the target cluster to enter the Cluster Details page. In the sidebar, click Node Management - Worker.
- On the node list page, click Add Node. In the Node Configuration section, select either the public image Ubuntu 22.04, or the target custom image.
- Complete the remaining steps to configure the node.
Scale out cgroup v2 nodes via node groups
- Sign in to the Baidu AI Cloud management console. Navigate to Product Services - Cloud Native - Cloud Container Engine (CCE). Click Cluster Management - Cluster List, then select the target cluster to enter the Cluster Details page. In the sidebar, click Node Management - Node Group.
- On the node group list page, click Create Node. In the Node Configuration section, select either the public image Ubuntu 22.04, or the target custom image.
- Complete the final steps to set up the node group.
Verify cgroup v2
Log in to the cluster node and run the following command to confirm the cgroup type. Check if the node within the cluster uses cgroup v2.
1 df -T /sys/fs/cgroup
Expected result:
1 Filesystem Type 1K-blocks Used Available Use% Mounted on
2 cgroup2 cgroup2 0 0 0 - /sys/fs/cgroup
Indicates that the cluster node is using cgroup v2.
