腾讯云K3S修改默认容器运行时

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 
#启动docker
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  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ncuwym

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值