microk8s: The memory cgroup is not enabled.
I appended cgroup_enable=memory cgroup_memory=1 to cmdline.txt file in each node and reboot but it not working.
microk8s inspect
Inspecting Certificates
Inspecting services
Service snap.microk8s.daemon-cluster-agent is running
Service snap.microk8s.daemon-containerd is running
Service snap.microk8s.daemon-apiserver is running
Service snap.microk8s.daemon-apiserver-kicker is running
Service snap.microk8s.daemon-proxy is running
Service snap.microk8s.daemon-kubelet is running
Service snap.microk8s.daemon-scheduler is running
Service snap.microk8s.daemon-controller-manager is running
Copy service arguments to the final report tarball
Inspecting AppArmor configuration
Gathering system information
Copy processes list to the final report tarball
Copy snap list to the final report tarball
Copy VM name (or none) to the final report tarball
Copy disk usage information to the final report tarball
Copy memory usage information to the final report tarball
Copy server uptime to the final report tarball
Copy current linux distribution to the final report tarball
Copy openSSL information to the final report tarball
Copy network configuration to the final report tarball
Inspecting kubernetes cluster
Inspect kubernetes cluster
WARNING: The memory cgroup is not enabled.
The cluster may not be functioning properly. Please ensure cgroups are enabled
See for example: https://microk8s.io/docs/install-alternatives#heading--arm
Building the report tarball
Report tarball is at /var/snap/microk8s/1669/inspection-report-20201027_221452.tar.gz
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 4
- Comments: 40 (4 by maintainers)
I needed all three of these.
Here is a fix for this in ubuntu 22.04. Open the file
/etc/default/grubin an editor. Find where the stringGRUB_CMDLINE_LINUXis set. Addcgroup_enable=memory cgroup_memory=1to that string. Save the file and exit the editor. Then runsudo update-grub. Here is how my grub file looks like:Then you may restart your computer. Then run
microk8s.inspect, everything should be ok. Below is my microk8s versionMicroK8s v1.25.2 revision 4055I’ve been trying to get microk8s 1.21/stable working on Ubuntu 21.10-arm64 on Pi-4 and it seems that perhaps microk8s doesn’t like the new default in Ubuntu 21.10 ( from the release notes )
systemd is being switched to the “unified” cgroup hierarchy (cgroup v2) by default. If for some reason you need to keep the legacy cgroup v1 hierarchy, you can select it via a kernel parameter at boot time: systemd.unified_cgroup_hierarchy=0 (bug 1850667 29)
So - after adding
systemd.unified_cgroup_hierarchy=0the issue with the memory cgroup error, goes away. (don’t forget to rebuild the initramfs!sudo update-initramfs -u)To see which ( V1 or V2 ) you have configured -
stat -c %T -f /sys/fs/cgroupV1 —
tmpfsV2 —
cgroup2fsIf you get errors about iptables or iptables-legacy ( it seems that installing the microk8s snap installs these rules anyway ) these two commands will clear the tables.
sudo iptables -F && sudo iptables -t nat -F && sudo iptables -t mangle -F && sudo iptables -Xsudo iptables-legacy -F && sudo iptables-legacy -t nat -F && sudo iptables-legacy -t mangle -F && sudo iptables-legacy -Xsystemd, strikes again.
For anyone installing MicroK8S on Ubuntu 22.04 not raspberry pi here is a link to the steps I took: Microk8s setup on ubuntu 22.04
Problem present on my system as well. Looks like the inspect test is faulty.
Have you experienced the same issue on them? Enabling Cgroups should generally work the same way for server-based OSs. Once you have added the following and updated your grub and initramfs. You should be good to go.
GRUB_CMDLINE_LINUX="cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0"This issue has been been fixed by https://github.com/canonical/microk8s/pull/3518.
Same here, amd64 working fine before Ubuntu upgrade, should I try to change cgroups to v1?