配置kubelet保留资源后,kubelet无法处理cgroup

时间:2020-01-21 01:35:44

标签: kubernetes kubelet

对于kubelet保留资源,我几乎没有疑问。我不知道我的配置是否正常工作。

步骤1: 我通过使用Follow命令创建cgroup目录

for i in `ls -L /sys/fs/cgroup`; do mkdir -p /sys/fs/cgroup/$i/kube-reserved.slice; done
for i in `ls -L /sys/fs/cgroup`; do mkdir -p /sys/fs/cgroup/$i/system-reserved.slice; done

步骤2: 另外像这样的kubelet参数:

--enforce-node-allocatable=pods,kube-reserved,system-reserved \
  --kube-reserved=cpu=1,memory=1Gi \
  --kube-reserved-cgroup=/kube-reserved.slice \
  --system-reserved=cpu=1,memory=1Gi \
  --system-reserved-cgroup=/system-reserved.slice \
  --cgroup-root=/ --v=4

在kubelet启动之后。我可以看到可分配节点已按预期更改。

Capacity:
 cpu:                8
 ephemeral-storage:  9480420Ki
 hugepages-1Gi:      0
 hugepages-2Mi:      0
 memory:             16414252Ki
 pods:               110
Allocatable:
 cpu:                6
 ephemeral-storage:  8737155058
 hugepages-1Gi:      0
 hugepages-2Mi:      0
 memory:             14214700Ki
 pods:               110

system-reserved.slice的Kubelet日志:

root@k8s-node02:~# journalctl -xeu kubelet |grep -v ignoring |grep system-reserved.slice
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.712207    7117 factory.go:177] Factory "docker" was unable to handle container "/system-reserved.slice"
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.712214    7117 factory.go:166] Error trying to work out if we can handle /system-reserved.slice: /system-reserved.slice not handled by systemd handler
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.712218    7117 factory.go:177] Factory "systemd" was unable to handle container "/system-reserved.slice"
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.712225    7117 factory.go:177] Factory "containerd" was unable to handle container "/system-reserved.slice"
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.715222    7117 factory.go:177] Factory "docker" was unable to handle container "/system-reserved.slice"
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.715229    7117 factory.go:166] Error trying to work out if we can handle /system-reserved.slice: /system-reserved.slice not handled by systemd handler
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.715232    7117 factory.go:177] Factory "systemd" was unable to handle container "/system-reserved.slice"
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.715238    7117 factory.go:177] Factory "containerd" was unable to handle container "/system-reserved.slice"

kube-reserved.slice的小程序日志:

root@k8s-node02:~# journalctl -xeu kubelet |grep -v ignoring |grep kube-reserved.slice
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.711765    7117 factory.go:177] Factory "docker" was unable to handle container "/kube-reserved.slice"
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.711772    7117 factory.go:166] Error trying to work out if we can handle /kube-reserved.slice: /kube-reserved.slice not handled by systemd handler
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.711776    7117 factory.go:177] Factory "systemd" was unable to handle container "/kube-reserved.slice"
Jan 20 11:23:46 k8s-node02 kubelet[7117]: I0120 11:23:46.711783    7117 factory.go:177] Factory "containerd" was unable to handle container "/kube-reserved.slice"
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.713871    7117 factory.go:177] Factory "docker" was unable to handle container "/kube-reserved.slice"
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.713877    7117 factory.go:166] Error trying to work out if we can handle /kube-reserved.slice: /kube-reserved.slice not handled by systemd handler
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.713880    7117 factory.go:177] Factory "systemd" was unable to handle container "/kube-reserved.slice"
Jan 20 11:24:46 k8s-node02 kubelet[7117]: I0120 11:24:46.713886    7117 factory.go:177] Factory "containerd" was unable to handle container "/kube-reserved.slice"

这正常用于设置资源保留吗?还是我的配置错误?

0 个答案:

没有答案
相关问题