Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Kubernetes Blog 11 min read Deep dive mediumAdept

The Shift to cgroup v2 in Kubernetes: What You Need to Know

Kubernetes has deprecated cgroup v1: from v1.35 the kubelet refuses to start on cgroup v1 nodes by default (`failCgroupV1: true`), kubeadm preflight errors on it, and the fallback is slated for removal in v1.38. cgroup v2 enables Memory QoS with `memory.high` throttling and tiered `memory.min`/`memory.low` reservations, container-wide OOM kills via `memory.oom.group`, safe rootless delegation, eBPF-based device control, PSI metrics, and accurate Pod-level in-place resizing. Migration requires kernel 5.8+ (5.9+ for Memory QoS), a cgroup v2-capable runtime, and matching cgroup drivers, ideally systemd with CRI auto-detection. A step-by-step procedure traces Pod resource limits from the API through CRI, OCI spec, and systemd scope down to the actual cgroup files.

Related posts

  • Kubernetes v1.38 Sneak Peek

    Kubernetes Blog hardMaster

    Kubernetes v1.38, planned for December 16, 2026, will require container runtimes to report the cgroup driver via the CRI RuntimeConfig RPC. The kubelet will reject the cgroupDriver config field unless the temporary LegacyCgroupDriverFallback gate is enabled, and kubeadm preflight will fail on runtimes that lack the RPC. On cgroup v2 nodes using LimitedSwap, swap limits will follow pod-level memory settings, so Pods whose pod-level request equals their limit get no swap. The kubectl WebSocket opt-out environment variables and the kuberc allowlist `name` field are removed. kuberc, pod-level resources and DRA partitionable devices are expected to go stable, and an alpha EvictionRequest API lets responders prepare Pods before eviction while still respecting PDBs.

  • Kubernetes v1.37: Memory QoS Graduates to Beta

    Kubernetes Blog mediumAdept

    Memory QoS is Beta and on by default in Kubernetes v1.37, using the cgroup v2 memory controller to guide how the kernel throttles and protects container memory. Turning it on by default is safe because the default memoryThrottlingFactor changed from 0.9 to null and memoryReservationPolicy defaults to None, so no memory.high, memory.min or memory.low values are written unless configured. Clusters that relied on the implicit 0.9 default must now set it explicitly to keep memory.high throttling. TieredReservation applies node-wide, with no per-pod opt-in or opt-out, and hard reservation includes page cache, which can starve neighboring pods.

  • Kubernetes v1.37 Sneak Peek

    Kubernetes Blog mediumAdept

    Kubernetes v1.37 deprecates kube-proxy's ipvs mode, which still relies on iptables underneath. ipvs is slated to be off by default by v1.40 and removed by v1.43. The release also deprecates `kubectl run -f`, strictly forbids static Pods from referencing Secrets or ConfigMaps, and keeps cgroup v1 behind a temporary `failCgroupV1: false` override ahead of its removal. SELinuxMount going GA is a breaking change: pods with different SELinux labels sharing a volume on one node may fail to start unless `seLinuxChangePolicy: Recursive` is set. Featured enhancements are the metrics.k8s.io API reaching GA, rootless kubelet in a user namespace moving to Beta, and a reworked alpha Volume Health Monitor with four new CSI RPCs that surface health in PVC, Pod and CSINode status.

  • Spin Infrastructure Adventures: Containers, Systemd, and CGroups

    Shopify Engineering hardMaster

    Spin development instances run systemd inside Kubernetes containers, and processes launched through systemd escaped the pod's memory cgroup, so pod memory limits were not enforced and instances could exceed their allotment and disturb neighbours. Using kubectl top and a stress test, the team showed that processes started via kubectl exec landed in the kubepods cgroup while those started via spin shell landed in an effectively unlimited hierarchy. Reproductions across containerd, Docker and Podman traced the cause to the cgroupfs driver: Podman's systemd cgroup driver correctly delegates limits to the in-container systemd. The leak came from bind-mounting /sys/fs/cgroup read-only, which leaves subdirectories writable, and the fix is switching to the systemd cgroup driver, which Container-Optimized OS plans to make the default in version 101.

  • Debugging Systems in the Cloud: MySQL, Kubernetes, and Cgroups

    Shopify Engineering hardMaster

    Slow MySQL Pod startup and degraded query performance on long-running GKE nodes in Shopify's KateSQL platform traced back to a Linux kernel memory cgroup leak: roughly 50K zombie memory cgroups made mem_cgroup_commit_charge slow, so each 128MB mmap during InnoDB buffer pool initialization took about 100 ms. The investigation used strace, perf flamegraphs, slabtop and /proc/cgroups, and Google kernel engineers confirmed it as a side effect of slab reparenting on cgroup removal. Forcing kubepods memory.force_empty cut cgroups to about 1800, and an 80G buffer pool then initialized in five seconds. The permanent fix was upgrading to GKE 1.18 (COS 85, kernel 5.4). Interim options included recycling nodes, dropping caches and isolating short-lived Pods.

The quest for software engineering knowledge.

Look:
Layout: