From ce2642f27ba86f898b9df442450864e3f93ef6e1 Mon Sep 17 00:00:00 2001
From: Franz Nemeth <franznemeth@users.noreply.github.com>
Date: Thu, 9 May 2024 14:40:03 +0200
Subject: [PATCH] feat: Adding a check which determines if cgroups are enabled
 on a node (#11163) (#11165)

---
 roles/kubernetes/preinstall/tasks/0040-verify-settings.yml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/roles/kubernetes/preinstall/tasks/0040-verify-settings.yml b/roles/kubernetes/preinstall/tasks/0040-verify-settings.yml
index 91b78b75f..55dda5b81 100644
--- a/roles/kubernetes/preinstall/tasks/0040-verify-settings.yml
+++ b/roles/kubernetes/preinstall/tasks/0040-verify-settings.yml
@@ -77,6 +77,13 @@
     - not ignore_assert_errors
     - inventory_hostname in groups['kube_node']
 
+# This command will fail if cgroups are not enabled on the node.
+# For reference: https://kubernetes.io/docs/concepts/architecture/cgroups/#check-cgroup-version
+- name: Stop if cgroups are not enabled on nodes
+  command: stat -fc %T /sys/fs/cgroup/
+  changed_when: false
+  when: not ignore_assert_errors
+
 # This assertion will fail on the safe side: One can indeed schedule more pods
 # on a node than the CIDR-range has space for when additional pods use the host
 # network namespace. It is impossible to ascertain the number of such pods at
-- 
GitLab