较新版本的docker desktop使用了cgroupv2,Rancher server的docker镜像,还要考虑历史兼容问题,所以server内置的k3s还不兼容cgroupv2的方式。所以我们需要将,Docker 切换回cgroup v1。
vi /etc/default/grub
添加:
GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=0"
更新grub配置,使修改生效
grub2-mkconfig -o /boot/grub2/grub.cfg
重启服务器
查看Linux cgrougp版本::
stat -fc %T /sys/fs/cgroup
对于cgroup v2,输出为 cgroup2fs。
对于cgroup v1,输出为tmpfs。
[root@cdss-server2 ~]# docker info
Client:
Debug Mode: false
Server:
Containers: 55
Running: 48
Paused: 0
Stopped: 7
Images: 44
Server Version: 19.03.12
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.17.11-1.el7.elrepo.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 10
Total Memory: 31.38GiB
Name: cdss-server2
ID: FCBD:GFLB:NPQT:3E4Z:QASL:TTWE:S63W:3JPN:7WOO:YTWO:LBSL:3D77
Docker Root Dir: /home/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
iregistry.baidu-int.com
registry.baidu.com
cdss-server1:5000
127.0.0.0/8
Live Restore Enabled: false
docker version:
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:46:54 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:45:28 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
[root@cdss-server1 ~]# runc --version
runc version 1.0.0-rc10
commit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
spec: 1.0.1-dev