k3s默认推荐使用 Containerd 作为容器运行环境。通过用containderd替换Docker,K3s能够显著减少运行时占用空间,删除了libnetwork、swarm、Docker存储驱动程序和其他插件等功能。
k3s服务在安装时也默认设置了containerd的容器管理工具 crictl。
一、centos8安装docker 在腾讯云的K3S应用中,默认使用Centos8系统搭建的k3s环境
yum -y install yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.13-3.1.el7.x86_64.rpm
dnf install docker-ce
systemctl start docker
systemctl enable docker
docker -v
二、修改k3s配置
vim /etc/systemd/system/multi-user.target.wants/k3s.service
[Unit]
Description=Lightweight Kubernetes
Documentation=https://k3s.io
Wants=network-online.target
After=network-online.target
[Install]
WantedBy=multi-user.target
[Service]
Type=notify
EnvironmentFile=/etc/systemd/system/k3s.service.env
KillMode=process
Delegate=yes
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Restart=always
RestartSec=5s
ExecStartPre=/sbin/modprobe br_netfilter
ExecStartPre=/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s server --write-kubeconfig-mode=644
修改EXecStart,追加--docker --no-deploy traefik
ExecStart=/usr/local/bin/k3s server --write-kubeconfig-mode=644 --docker --no-deploy traefik
重载服务配置文件:
systemctl daemon-reload
重启k3s服务
systemctl k3s restart
|