minikube: minikube 1.23: Your cgroup does not allow setting memory

Steps to reproduce the issue:

  1. minikube start --memory=8192 --cpus 2 --kubernetes-version=v1.22.1
πŸ˜„  minikube v1.23.2 on Ubuntu 20.04
✨  Automatically selected the docker driver. Other choices: virtualbox, ssh
❗  Your cgroup does not allow setting memory.
    β–ͺ More information: https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ”₯  Creating docker container (CPUs=2, Memory=8192MB) ...
🐳  Preparing Kubernetes v1.22.1 on Docker 20.10.8 ...
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
  • minikube 1.23.2
  • docker 20.10.5
  • ubuntu 20.04.2
docker stats

CONTAINER ID   NAME       CPU %     MEM USAGE / LIMIT     MEM %     NET I/O         BLOCK I/O    PIDS
4ec4a910c4e5   minikube   14.05%    573.4MiB / 62.74GiB   0.89%     191kB / 294kB   0B / 229kB   323

As you can see, there’s NO memory limit.

grep GRUB_CMDLINE_LINUX /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

Of course, I run sudo update-grub2 without errors and reboot the PC.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (6 by maintainers)

Most upvoted comments

Hi @klaases, yes. On Ubuntu the filename is: /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes instead of /sys/fs/cgroup/memory/memsw.limit_in_bytes That’s why the HasMemoryCgroup check fails.

@medyagh I already read that.

But If I run:

docker run -it -m 8m --rm nginx

CONTAINER ID   NAME            CPU %     MEM USAGE / LIMIT     MEM %     NET I/O         BLOCK I/O     PIDS
32273ec91d5d   dazzling_kare   0.00%     6.875MiB / 8MiB       85.94%    3.65kB / 0B     0B / 16.4kB   9
4ec4a910c4e5   minikube        15.70%    586.3MiB / 62.74GiB   0.91%     212kB / 294kB   0B / 229kB    324

You can notice the nginx container has the limit, so it’s a minikube stuff, not docker / cgroups related.

hey @kadern0 , it looks like I still have the same issue. Here is the output:

> ./out/minikube start --memory=8192 --cpus 2 --kubernetes-version=v1.22.1
πŸ˜„  minikube v1.25.2 on Ubuntu 22.04
πŸ†•  Kubernetes 1.23.5 is now available. If you would like to upgrade, specify: --kubernetes-version=v1.23.5
✨  Using the docker driver based on existing profile
❗  Your cgroup does not allow setting memory.
    β–ͺ More information: https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities
❗  Your cgroup does not allow setting memory.
    β–ͺ More information: https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ”„  Restarting existing docker container for "minikube" ...
🐳  Preparing Kubernetes v1.22.1 on Docker 20.10.13 ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

I have ensure grub options are in place to enable setting the cgroup swap limit, and I can follow all steps shown in this blog post and they work: https://fabianlee.org/2020/01/18/docker-placing-limits-on-container-memory-using-cgroups/

Let me know if there is anything else to test.

EDIT: I’m on Ubuntu 22.04.

Happy it is working for you, @hoppla20. @vuldin, I’ve tested it in Ubuntu and it worked for me, did you run git checkout issue-12842 before running the make command?

AHH sorry I rushed through too fast and didn’t switch branch initially… I just tried with the right branch and it works:

> > ./out/minikube start --memory=8192 --cpus 2 --kubernetes-version=v1.22.1
...
> docker stats
CONTAINER ID   NAME       CPU %     MEM USAGE / LIMIT   MEM %     NET I/O         BLOCK I/O        PIDS
91efdf18a64c   minikube   9.13%     719.2MiB / 8GiB     8.78%     160kB / 194kB   283MB / 29.4MB   357

Thanks!

Hey, I just wanted to add, that @kadern0’s fix works for me. I’m using PopOS 22.04:

uname -a:

Linux pop-os 5.16.19-76051619-generic #202204081339~1649696161~22.04~091f44b SMP PREEMPT Mon Apr 11 17 x86_64 x86_64 x86_64 GNU/Linux

minikube version:

minikube version: v1.25.2
commit: 2da5b65085d4a82eb255adeaae718926b6fe48b2

ls -l /sys/fs/cgroup:

-r--r--r--  1 root root 0 May  4 19:30 cgroup.controllers
-rw-r--r--  1 root root 0 May  5 10:14 cgroup.max.depth
-rw-r--r--  1 root root 0 May  5 10:14 cgroup.max.descendants
-rw-r--r--  1 root root 0 May  4 19:30 cgroup.procs
-r--r--r--  1 root root 0 May  5 10:14 cgroup.stat
-rw-r--r--  1 root root 0 May  4 19:30 cgroup.subtree_control
-rw-r--r--  1 root root 0 May  5 10:14 cgroup.threads
-rw-r--r--  1 root root 0 May  5 10:14 cpu.pressure
-r--r--r--  1 root root 0 May  4 19:30 cpuset.cpus.effective
-r--r--r--  1 root root 0 May  4 19:30 cpuset.mems.effective
-r--r--r--  1 root root 0 May  5 10:14 cpu.stat
drwxr-xr-x  2 root root 0 May  4 19:36 dev-hugepages.mount
drwxr-xr-x  2 root root 0 May  4 19:36 dev-mqueue.mount
drwxr-xr-x  2 root root 0 May  4 19:30 init.scope
-rw-r--r--  1 root root 0 May  5 10:14 io.cost.model
-rw-r--r--  1 root root 0 May  5 10:14 io.cost.qos
-rw-r--r--  1 root root 0 May  5 10:14 io.pressure
-rw-r--r--  1 root root 0 May  5 10:14 io.prio.class
-r--r--r--  1 root root 0 May  5 10:14 io.stat
-r--r--r--  1 root root 0 May  5 10:14 memory.numa_stat
-rw-r--r--  1 root root 0 May  5 10:14 memory.pressure
-r--r--r--  1 root root 0 May  5 10:14 memory.stat
-r--r--r--  1 root root 0 May  5 10:14 misc.capacity
drwxr-xr-x  2 root root 0 May  4 19:36 sys-fs-fuse-connections.mount
drwxr-xr-x  2 root root 0 May  4 19:36 sys-kernel-config.mount
drwxr-xr-x  2 root root 0 May  4 19:36 sys-kernel-debug.mount
drwxr-xr-x  2 root root 0 May  4 19:36 sys-kernel-tracing.mount
drwxr-xr-x 48 root root 0 May  5 10:08 system.slice
drwxr-xr-x  3 root root 0 May  4 19:36 user.slice

cat /sys/fs/cgroup/cgroup.subtree_control :

cpuset cpu io memory hugetlb pids rdma misc

with following kernel parameters (using systemd-boot):

systemd.unified_cgroup_hierarchy=1 swapaccount=1

minikube start --cpus 6 --memory 24g --kubernetes-version=v1.20.11:

πŸ˜„  [minikube-local] minikube v1.25.2 on Debian bookworm/sid
✨  Automatically selected the docker driver
πŸ“Œ  Using Docker driver with the root privilege
πŸ‘  Starting control plane node minikube-local in cluster minikube-local
🚜  Pulling base image ...
πŸ’Ύ  Downloading Kubernetes v1.20.11 preload ...
    > preloaded-images-k8s-v18-v1...: 366.61 MiB / 366.61 MiB  100.00% 827.62 K
πŸ”₯  Creating docker container (CPUs=6, Memory=24576MB) ...
🐳  Preparing Kubernetes v1.20.11 on Docker 20.10.13 ...
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...

@vuldin, if you follow the instructions here you can build minikube yourself. You will have to use my git repo and checkout to the issue-12842 branch before running the make command.

It would seem like we need to check both /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes and /sys/fs/cgroup/memory/memory.limit_in_bytes, which feels doable.