in Kubernetes

Docker修改cgroup的driver为Systemd

问题

Docker默认的cgroup的driver是cgroupfs, 为了系统的稳定,建议使用单一的cgroup的driver,也就是systemd,进行了修改。

[root@Master ~]# docker info|grep Cgroup
 Cgroup Driver: cgroupfs
 Cgroup Version: 1

需要修改Docker cgroup的driver为Systemd

解决

[root@Master ~]# vim /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"]
}
[root@Master ~]#  docker info|grep Cgroup
 Cgroup Driver: systemd
 Cgroup Version: 1
[root@Master ~]# 

[root@Master ~]# systemctl restart docker

另一个问题:The connection to the server localhost:8080 was refused – did you specify the right host or port?

原因是没有运行以下指令:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

参考

Kubernetes Documentation: Container Runtimes
The connection to the server localhost:8080 was refused – did you specify the right host or port?
Stackoverflow: docker change cgroup driver to systemd

Write a Comment

Comment