Fix rootless regression in 1.22 (Set KubeletInUserNamespace gate) (#3901)

Fix issue 3900

Kubernetes 1.22 requires `KuebletInUserNamespace` feature gate to be set for rootless:
https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns/#userns-the-hard-way

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
pull/3902/head
Akihiro Suda 2021-08-25 00:27:17 +09:00 committed by GitHub
parent 66dacc6ee0
commit 176451f4ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import (
)
func createRootlessConfig(argsMap map[string]string, hasCFS, hasPIDs bool) {
argsMap["feature-gates=KubeletInUserNamespace"] = "true"
// "/sys/fs/cgroup" is namespaced
cgroupfsWritable := unix.Access("/sys/fs/cgroup", unix.W_OK) == nil
if hasCFS && hasPIDs && cgroupfsWritable {