kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.23k stars 4.87k forks source link

The check for memory limits is currently broken for cgroups v1 #11609

Open afbjorklund opened 3 years ago

afbjorklund commented 3 years ago

Currently it checks "" (empty string), if cgroup2 is false:

// HasMemoryCgroup checks whether it is possible to set memory limit for cgroup.
func HasMemoryCgroup() bool {
        memcg := true
        if runtime.GOOS == "linux" {
                var memory string
                if cgroup2, err := IsCgroup2UnifiedMode(); err == nil && cgroup2 {
                        memory = "/sys/fs/cgroup/memory/memsw.limit_in_bytes"
                }
                if _, err := os.Stat(memory); os.IsNotExist(err) {
                        klog.Warning("Your kernel does not support memory limit capabilities or the cgroup is not mounted.")
                        memcg = false
                }
        }
        return memcg
}

Since 7b0bf57f4c9b87a7b0c9362bdfbb5c0add2094d7

Most likely the code is also wrong for cgroups v2 as well ?

The end result is no memory limits, for the docker driver.

Seems to be the same issue as in #10935

sharifelgamal commented 3 years ago

Yeah this seems like a simple fix, let's do it ASAP.

sharifelgamal commented 3 years ago

@daehyeok could you look at this?

afbjorklund commented 3 years ago

Will let someone look at this, wasn't so simple it seems.

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

sharifelgamal commented 2 years ago

This remains an issue we'd like to fix.