diff --git a/pkg/daemons/agent/agent.go b/pkg/daemons/agent/agent.go index d1097ebc8f..76792645a2 100644 --- a/pkg/daemons/agent/agent.go +++ b/pkg/daemons/agent/agent.go @@ -11,6 +11,7 @@ import ( "github.com/opencontainers/runc/libcontainer/system" "github.com/rancher/k3s/pkg/daemons/config" "github.com/rancher/k3s/pkg/daemons/executor" + "github.com/rancher/k3s/pkg/version" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/util/net" "k8s.io/component-base/logs" @@ -20,8 +21,6 @@ import ( _ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration ) -const k3sCgroupRoot = "/k3s" - func Agent(config *config.Agent) error { rand.Seed(time.Now().UTC().UnixNano()) @@ -210,7 +209,7 @@ func checkCgroups() (kubeletRoot, runtimeRoot string, hasCFS, hasPIDs bool) { last := parts[len(parts)-1] i := strings.LastIndex(last, ".scope") if i > 0 { - kubeletRoot = k3sCgroupRoot + kubeletRoot = "/" + version.Program } } } @@ -238,8 +237,8 @@ func checkCgroups() (kubeletRoot, runtimeRoot string, hasCFS, hasPIDs bool) { if system == "name=systemd" { last := parts[len(parts)-1] if last != "/" && last != "/init.scope" { - kubeletRoot = k3sCgroupRoot - runtimeRoot = k3sCgroupRoot + kubeletRoot = "/" + version.Program + runtimeRoot = "/" + version.Program } } }