mirror of https://github.com/k3s-io/k3s
Merge pull request #349 from erikwilson/missing-cgroup-pids-fix
Check for cgroup pids supportpull/355/head v0.4.0-rc3
commit
be24f837bb
|
@ -101,17 +101,23 @@ func kubelet(cfg *config.Agent) {
|
||||||
if err != nil || defaultIP.String() != cfg.NodeIP {
|
if err != nil || defaultIP.String() != cfg.NodeIP {
|
||||||
argsMap["node-ip"] = cfg.NodeIP
|
argsMap["node-ip"] = cfg.NodeIP
|
||||||
}
|
}
|
||||||
root, hasCFS := checkCgroups()
|
root, hasCFS, hasPIDs := checkCgroups()
|
||||||
if !hasCFS {
|
if !hasCFS {
|
||||||
logrus.Warn("Disabling CPU quotas due to missing cpu.cfs_period_us")
|
logrus.Warn("Disabling CPU quotas due to missing cpu.cfs_period_us")
|
||||||
argsMap["cpu-cfs-quota"] = "false"
|
argsMap["cpu-cfs-quota"] = "false"
|
||||||
}
|
}
|
||||||
|
if !hasPIDs {
|
||||||
|
logrus.Warn("Disabling pod PIDs limit feature due to missing cgroup pids support")
|
||||||
|
argsMap["cgroups-per-qos"] = "false"
|
||||||
|
argsMap["enforce-node-allocatable"] = ""
|
||||||
|
argsMap["feature-gates"] = addFeatureGate(argsMap["feature-gates"], "SupportPodPidsLimit=false")
|
||||||
|
}
|
||||||
if root != "" {
|
if root != "" {
|
||||||
argsMap["runtime-cgroups"] = root
|
argsMap["runtime-cgroups"] = root
|
||||||
argsMap["kubelet-cgroups"] = root
|
argsMap["kubelet-cgroups"] = root
|
||||||
}
|
}
|
||||||
if system.RunningInUserNS() {
|
if system.RunningInUserNS() {
|
||||||
argsMap["feature-gates"] = "DevicePlugins=false"
|
argsMap["feature-gates"] = addFeatureGate(argsMap["feature-gates"], "DevicePlugins=false")
|
||||||
}
|
}
|
||||||
|
|
||||||
args := config.GetArgsList(argsMap, cfg.ExtraKubeletArgs)
|
args := config.GetArgsList(argsMap, cfg.ExtraKubeletArgs)
|
||||||
|
@ -123,15 +129,20 @@ func kubelet(cfg *config.Agent) {
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkCgroups() (string, bool) {
|
func addFeatureGate(current, new string) string {
|
||||||
|
if current == "" {
|
||||||
|
return new
|
||||||
|
}
|
||||||
|
return current + "," + new
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkCgroups() (root string, hasCFS bool, hasPIDs bool) {
|
||||||
f, err := os.Open("/proc/self/cgroup")
|
f, err := os.Open("/proc/self/cgroup")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", false
|
return "", false, false
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
ret := false
|
|
||||||
root := ""
|
|
||||||
scan := bufio.NewScanner(f)
|
scan := bufio.NewScanner(f)
|
||||||
for scan.Scan() {
|
for scan.Scan() {
|
||||||
parts := strings.Split(scan.Text(), ":")
|
parts := strings.Split(scan.Text(), ":")
|
||||||
|
@ -140,10 +151,12 @@ func checkCgroups() (string, bool) {
|
||||||
}
|
}
|
||||||
systems := strings.Split(parts[1], ",")
|
systems := strings.Split(parts[1], ",")
|
||||||
for _, system := range systems {
|
for _, system := range systems {
|
||||||
if system == "cpu" {
|
if system == "pids" {
|
||||||
|
hasPIDs = true
|
||||||
|
} else if system == "cpu" {
|
||||||
p := filepath.Join("/sys/fs/cgroup", parts[1], parts[2], "cpu.cfs_period_us")
|
p := filepath.Join("/sys/fs/cgroup", parts[1], parts[2], "cpu.cfs_period_us")
|
||||||
if _, err := os.Stat(p); err == nil {
|
if _, err := os.Stat(p); err == nil {
|
||||||
ret = true
|
hasCFS = true
|
||||||
}
|
}
|
||||||
} else if system == "name=systemd" {
|
} else if system == "name=systemd" {
|
||||||
last := parts[len(parts)-1]
|
last := parts[len(parts)-1]
|
||||||
|
@ -155,5 +168,5 @@ func checkCgroups() (string, bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return root, ret
|
return root, hasCFS, hasPIDs
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,7 +295,7 @@ import:
|
||||||
- package: k8s.io/klog
|
- package: k8s.io/klog
|
||||||
version: v0.2.0-14-g8e90cee79f8237
|
version: v0.2.0-14-g8e90cee79f8237
|
||||||
- package: k8s.io/kubernetes
|
- package: k8s.io/kubernetes
|
||||||
version: v1.14.1-k3s.3
|
version: v1.14.1-k3s.4
|
||||||
repo: https://github.com/rancher/k3s.git
|
repo: https://github.com/rancher/k3s.git
|
||||||
transitive: true
|
transitive: true
|
||||||
staging: true
|
staging: true
|
||||||
|
|
|
@ -9,7 +9,7 @@ package=github.com/opencontainers/runc/libcontainer/nsenter
|
||||||
package=github.com/opencontainers/runc/libcontainer/specconv
|
package=github.com/opencontainers/runc/libcontainer/specconv
|
||||||
package=github.com/opencontainers/runc/contrib/cmd/recvtty
|
package=github.com/opencontainers/runc/contrib/cmd/recvtty
|
||||||
|
|
||||||
k8s.io/kubernetes v1.14.1-k3s.3 https://github.com/rancher/k3s.git transitive=true,staging=true
|
k8s.io/kubernetes v1.14.1-k3s.4 https://github.com/rancher/k3s.git transitive=true,staging=true
|
||||||
|
|
||||||
github.com/rancher/norman 50017efee23caa79542ef685b65a7b783e0a73ca https://github.com/ibuildthecloud/norman.git
|
github.com/rancher/norman 50017efee23caa79542ef685b65a7b783e0a73ca https://github.com/ibuildthecloud/norman.git
|
||||||
github.com/coreos/flannel 823afe66b2266bf71f5bec24e6e28b26d70cfc7c https://github.com/ibuildthecloud/flannel.git
|
github.com/coreos/flannel 823afe66b2266bf71f5bec24e6e28b26d70cfc7c https://github.com/ibuildthecloud/flannel.git
|
||||||
|
|
|
@ -3,8 +3,8 @@ package version
|
||||||
var (
|
var (
|
||||||
gitMajor = "1"
|
gitMajor = "1"
|
||||||
gitMinor = "14"
|
gitMinor = "14"
|
||||||
gitVersion = "v1.14.1-k3s.3"
|
gitVersion = "v1.14.1-k3s.4"
|
||||||
gitCommit = "4ebc432f987a09a4e215fc530c3aed911922e4b4"
|
gitCommit = "52f3b42401c93c36467f1fd6d294a3aba26c7def"
|
||||||
gitTreeState = "clean"
|
gitTreeState = "clean"
|
||||||
buildDate = "2019-04-11T20:33+00:00Z"
|
buildDate = "2019-04-15T22:13+00:00Z"
|
||||||
)
|
)
|
||||||
|
|
|
@ -169,6 +169,7 @@ func CreateServerChain(completedOptions completedServerRunOptions, stopCh <-chan
|
||||||
|
|
||||||
if DefaultProxyDialerFn != nil {
|
if DefaultProxyDialerFn != nil {
|
||||||
completedOptions.KubeletConfig.Dial = DefaultProxyDialerFn
|
completedOptions.KubeletConfig.Dial = DefaultProxyDialerFn
|
||||||
|
completedOptions.KubeletConfig.Proxy = http.ProxyURL(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
kubeAPIServerConfig, insecureServingInfo, serviceResolver, pluginInitializer, admissionPostStartHook, err := CreateKubeAPIServerConfig(completedOptions, proxyTransport)
|
kubeAPIServerConfig, insecureServingInfo, serviceResolver, pluginInitializer, admissionPostStartHook, err := CreateKubeAPIServerConfig(completedOptions, proxyTransport)
|
||||||
|
|
|
@ -19,6 +19,7 @@ package client
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -51,6 +52,9 @@ type KubeletClientConfig struct {
|
||||||
|
|
||||||
// Dial is a custom dialer used for the client
|
// Dial is a custom dialer used for the client
|
||||||
Dial utilnet.DialFunc
|
Dial utilnet.DialFunc
|
||||||
|
|
||||||
|
// Proxy is a custom proxy function for the client
|
||||||
|
Proxy func(*http.Request) (*url.URL, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConnectionInfo provides the information needed to connect to a kubelet
|
// ConnectionInfo provides the information needed to connect to a kubelet
|
||||||
|
@ -77,6 +81,7 @@ func MakeTransport(config *KubeletClientConfig) (http.RoundTripper, error) {
|
||||||
rt = utilnet.SetOldTransportDefaults(&http.Transport{
|
rt = utilnet.SetOldTransportDefaults(&http.Transport{
|
||||||
DialContext: config.Dial,
|
DialContext: config.Dial,
|
||||||
TLSClientConfig: tlsConfig,
|
TLSClientConfig: tlsConfig,
|
||||||
|
Proxy: config.Proxy,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ package version
|
||||||
var (
|
var (
|
||||||
gitMajor = "1"
|
gitMajor = "1"
|
||||||
gitMinor = "14"
|
gitMinor = "14"
|
||||||
gitVersion = "v1.14.1-k3s.3"
|
gitVersion = "v1.14.1-k3s.4"
|
||||||
gitCommit = "4ebc432f987a09a4e215fc530c3aed911922e4b4"
|
gitCommit = "52f3b42401c93c36467f1fd6d294a3aba26c7def"
|
||||||
gitTreeState = "clean"
|
gitTreeState = "clean"
|
||||||
buildDate = "2019-04-11T20:33+00:00Z"
|
buildDate = "2019-04-15T22:13+00:00Z"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue